| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 | 2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
| (function(){var ripple;(function(){var modules={};var requireStack=[];var inProgressModules={};function build(module){var factory=module.factory;module.exports={};delete module.factory;factory(ripple,module.exports,module);return module.exports}ripple=function(id){if(!modules[id]){throw"module "+id+" not found"}else if(id in inProgressModules){var cycle=requireStack.slice(inProgressModules[id]).join("->")+"->"+id;throw"Cycle in require graph: "+cycle}if(modules[id].factory){try{inProgressModules[id]=requireStack.length;requireStack.push(id);return build(modules[id])}finally{delete inProgressModules[id];requireStack.pop()}}return modules[id].exports};ripple.define=function(id,factory){if(modules[id]){throw"module "+id+" already defined"}modules[id]={id:id,factory:factory}};ripple.define.remove=function(id){delete modules[id]}})();Eif(typeof module==="object"&&typeof ripple==="function"){module.exports.ripple=ripple}(function(window,undefined){var document=window.document,navigator=window.navigator,location=window.location;var jQuery=function(){var jQuery=function(selector,context){return new jQuery.fn.init(selector,context,rootjQuery)},_jQuery=window.jQuery,_$=window.$,rootjQuery,quickExpr=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,rnotwhite=/\S/,trimLeft=/^\s+/,trimRight=/\s+$/,rdigit=/\d/,rsingleTag=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,rvalidchars=/^[\],:{}\s]*$/,rvalidescape=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rvalidtokens=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rvalidbraces=/(?:^|:|,)(?:\s*\[)+/g,rwebkit=/(webkit)[ \/]([\w.]+)/,ropera=/(opera)(?:.*version)?[ \/]([\w.]+)/,rmsie=/(msie) ([\w.]+)/,rmozilla=/(mozilla)(?:.*? rv:([\w.]+))?/,userAgent=navigator.userAgent,browserMatch,readyList,DOMContentLoaded,toString=Object.prototype.toString,hasOwn=Object.prototype.hasOwnProperty,push=Array.prototype.push,slice=Array.prototype.slice,trim=String.prototype.trim,indexOf=Array.prototype.indexOf,class2type={};jQuery.fn=jQuery.prototype={constructor:jQuery,init:function(selector,context,rootjQuery){var match,elem,ret,doc;if(!selector){return this}if(selector.nodeType){this.context=this[0]=selector;this.length=1;return this}if(selector==="body"&&!context&&document.body){this.context=document;this[0]=document.body;this.selector=selector;this.length=1;return this}if(typeof selector==="string"){if(selector.charAt(0)==="<"&&selector.charAt(selector.length-1)===">"&&selector.length>=3){match=[null,selector,null]}else{match=quickExpr.exec(selector)}if(match&&(match[1]||!context)){if(match[1]){context=context instanceof jQuery?context[0]:context;doc=context?context.ownerDocument||context:document;ret=rsingleTag.exec(selector);if(ret){if(jQuery.isPlainObject(context)){selector=[document.createElement(ret[1])];jQuery.fn.attr.call(selector,context,true)}else{selector=[doc.createElement(ret[1])]}}else{ret=jQuery.buildFragment([match[1]],[doc]);selector=(ret.cacheable?jQuery.clone(ret.fragment):ret.fragment).childNodes}return jQuery.merge(this,selector)}else{elem=document.getElementById(match[2]);if(elem&&elem.parentNode){if(elem.id!==match[2]){return rootjQuery.find(selector)}this.length=1;this[0]=elem}this.context=document;this.selector=selector;return this}}else if(!context||context.jquery){return(context||rootjQuery).find(selector)}else{return this.constructor(context).find(selector)}}else if(jQuery.isFunction(selector)){return rootjQuery.ready(selector)}if(selector.selector!==undefined){this.selector=selector.selector;this.context=selector.context}return jQuery.makeArray(selector,this)},selector:"",jquery:"1.6",length:0,size:function(){return this.length},toArray:function(){return slice.call(this,0)},get:function(num){return num==null?this.toArray():num<0?this[this.length+num]:this[num]},pushStack:function(elems,name,selector){var ret=this.constructor();if(jQuery.isArray(elems)){push.apply(ret,elems)}else{jQuery.merge(ret,elems)}ret.prevObject=this;ret.context=this.context;if(name==="find"){ret.selector=this.selector+(this.selector?" ":"")+selector}else if(name){ret.selector=this.selector+"."+name+"("+selector+")"}return ret},each:function(callback,args){return jQuery.each(this,callback,args)},ready:function(fn){jQuery.bindReady();readyList.done(fn);return this},eq:function(i){return i===-1?this.slice(i):this.slice(i,+i+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(slice.apply(this,arguments),"slice",slice.call(arguments).join(","))},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem)}))},end:function(){return this.prevObject||this.constructor(null)},push:push,sort:[].sort,splice:[].splice};jQuery.fn.init.prototype=jQuery.fn;jQuery.extend=jQuery.fn.extend=function(){var options,name,src,copy,copyIsArray,clone,target=arguments[0]||{},i=1,length=arguments.length,deep=false;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2}if(typeof target!=="object"&&!jQuery.isFunction(target)){target={}}if(length===i){target=this;--i}for(;i<length;i++){if((options=arguments[i])!=null){for(name in options){src=target[name];copy=options[name];if(target===copy){continue}if(deep&©&&(jQuery.isPlainObject(copy)||(copyIsArray=jQuery.isArray(copy)))){if(copyIsArray){copyIsArray=false;clone=src&&jQuery.isArray(src)?src:[]}else{clone=src&&jQuery.isPlainObject(src)?src:{}}target[name]=jQuery.extend(deep,clone,copy)}else if(copy!==undefined){target[name]=copy}}}}return target};jQuery.extend({noConflict:function(deep){if(window.$===jQuery){window.$=_$}if(deep&&window.jQuery===jQuery){window.jQuery=_jQuery}return jQuery},isReady:false,readyWait:1,holdReady:function(hold){if(hold){jQuery.readyWait++}else{jQuery.ready(true)}},ready:function(wait){if(wait===true&&!--jQuery.readyWait||wait!==true&&!jQuery.isReady){if(!document.body){return setTimeout(jQuery.ready,1)}jQuery.isReady=true;if(wait!==true&&--jQuery.readyWait>0){return}readyList.resolveWith(document,[jQuery]);if(jQuery.fn.trigger){jQuery(document).trigger("ready").unbind("ready")}}},bindReady:function(){if(readyList){return}readyList=jQuery._Deferred();if(document.readyState==="complete"){return setTimeout(jQuery.ready,1)}if(document.addEventListener){document.addEventListener("DOMContentLoaded",DOMContentLoaded,false);window.addEventListener("load",jQuery.ready,false)}else if(document.attachEvent){document.attachEvent("onreadystatechange",DOMContentLoaded);window.attachEvent("onload",jQuery.ready);var toplevel=false;try{toplevel=window.frameElement==null}catch(e){}if(document.documentElement.doScroll&&toplevel){doScrollCheck()}}},isFunction:function(obj){return jQuery.type(obj)==="function"},isArray:Array.isArray||function(obj){return jQuery.type(obj)==="array"},isWindow:function(obj){return obj&&typeof obj==="object"&&"setInterval"in obj},isNaN:function(obj){return obj==null||!rdigit.test(obj)||isNaN(obj)},type:function(obj){return obj==null?String(obj):class2type[toString.call(obj)]||"object"},isPlainObject:function(obj){if(!obj||jQuery.type(obj)!=="object"||obj.nodeType||jQuery.isWindow(obj)){return false}if(obj.constructor&&!hasOwn.call(obj,"constructor")&&!hasOwn.call(obj.constructor.prototype,"isPrototypeOf")){return false}var key;for(key in obj){}return key===undefined||hasOwn.call(obj,key)},isEmptyObject:function(obj){for(var name in obj){return false}return true},error:function(msg){throw msg},parseJSON:function(data){if(typeof data!=="string"||!data){return null}data=jQuery.trim(data);if(window.JSON&&window.JSON.parse){return window.JSON.parse(data)}if(rvalidchars.test(data.replace(rvalidescape,"@").replace(rvalidtokens,"]").replace(rvalidbraces,""))){return new Function("return "+data)()}jQuery.error("Invalid JSON: "+data)},parseXML:function(data,xml,tmp){if(window.DOMParser){tmp=new DOMParser;xml=tmp.parseFromString(data,"text/xml")}else{xml=new ActiveXObject("Microsoft.XMLDOM");xml.async="false";xml.loadXML(data)}tmp=xml.documentElement;if(!tmp||!tmp.nodeName||tmp.nodeName==="parsererror"){jQuery.error("Invalid XML: "+data)}return xml},noop:function(){},globalEval:function(data){if(data&&rnotwhite.test(data)){(window.execScript||function(data){window["eval"].call(window,data)})(data)}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()===name.toUpperCase()},each:function(object,callback,args){var name,i=0,length=object.length,isObj=length===undefined||jQuery.isFunction(object);if(args){if(isObj){for(name in object){if(callback.apply(object[name],args)===false){break}}}else{for(;i<length;){if(callback.apply(object[i++],args)===false){break}}}}else{if(isObj){for(name in object){if(callback.call(object[name],name,object[name])===false){break}}}else{for(;i<length;){if(callback.call(object[i],i,object[i++])===false){break}}}}return object},trim:trim?function(text){return text==null?"":trim.call(text)}:function(text){return text==null?"":text.toString().replace(trimLeft,"").replace(trimRight,"")},makeArray:function(array,results){var ret=results||[];if(array!=null){var type=jQuery.type(array);if(array.length==null||type==="string"||type==="function"||type==="regexp"||jQuery.isWindow(array)){push.call(ret,array)}else{jQuery.merge(ret,array)}}return ret},inArray:function(elem,array){if(indexOf){return indexOf.call(array,elem)}for(var i=0,length=array.length;i<length;i++){if(array[i]===elem){return i}}return-1},merge:function(first,second){var i=first.length,j=0;if(typeof second.length==="number"){for(var l=second.length;j<l;j++){first[i++]=second[j]}}else{while(second[j]!==undefined){first[i++]=second[j++]}}first.length=i;return first},grep:function(elems,callback,inv){var ret=[],retVal;inv=!!inv;for(var i=0,length=elems.length;i<length;i++){retVal=!!callback(elems[i],i);if(inv!==retVal){ret.push(elems[i])}}return ret},map:function(elems,callback,arg){var value,key,ret=[],i=0,length=elems.length,isArray=elems instanceof jQuery||length!==undefined&&typeof length==="number"&&(length>0&&elems[0]&&elems[length-1]||length===0||jQuery.isArray(elems));if(isArray){for(;i<length;i++){value=callback(elems[i],i,arg);if(value!=null){ret[ret.length]=value}}}else{for(key in elems){value=callback(elems[key],key,arg);if(value!=null){ret[ret.length]=value}}}return ret.concat.apply([],ret)},guid:1,proxy:function(fn,context){if(typeof context==="string"){var tmp=fn[context];context=fn;fn=tmp}if(!jQuery.isFunction(fn)){return undefined}var args=slice.call(arguments,2),proxy=function(){return fn.apply(context,args.concat(slice.call(arguments)))};proxy.guid=fn.guid=fn.guid||proxy.guid||jQuery.guid++;return proxy},access:function(elems,key,value,exec,fn,pass){var length=elems.length;if(typeof key==="object"){for(var k in key){jQuery.access(elems,k,key[k],exec,fn,value)}return elems}if(value!==undefined){exec=!pass&&exec&&jQuery.isFunction(value);for(var i=0;i<length;i++){fn(elems[i],key,exec?value.call(elems[i],i,fn(elems[i],key)):value,pass)}return elems}return length?fn(elems[0],key):undefined},now:function(){return(new Date).getTime()},uaMatch:function(ua){ua=ua.toLowerCase();var match=rwebkit.exec(ua)||ropera.exec(ua)||rmsie.exec(ua)||ua.indexOf("compatible")<0&&rmozilla.exec(ua)||[];return{browser:match[1]||"",version:match[2]||"0"}},sub:function(){function jQuerySub(selector,context){return new jQuerySub.fn.init(selector,context)}jQuery.extend(true,jQuerySub,this);jQuerySub.superclass=this;jQuerySub.fn=jQuerySub.prototype=this();jQuerySub.fn.constructor=jQuerySub;jQuerySub.sub=this.sub;jQuerySub.fn.init=function init(selector,context){if(context&&context instanceof jQuery&&!(context instanceof jQuerySub)){context=jQuerySub(context)}return jQuery.fn.init.call(this,selector,context,rootjQuerySub)};jQuerySub.fn.init.prototype=jQuerySub.fn;var rootjQuerySub=jQuerySub(document);return jQuerySub},browser:{}});jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(i,name){class2type["[object "+name+"]"]=name.toLowerCase()});browserMatch=jQuery.uaMatch(userAgent);if(browserMatch.browser){jQuery.browser[browserMatch.browser]=true;jQuery.browser.version=browserMatch.version}if(jQuery.browser.webkit){jQuery.browser.safari=true}if(rnotwhite.test(" ")){trimLeft=/^[\s\xA0]+/;trimRight=/[\s\xA0]+$/}rootjQuery=jQuery(document);if(document.addEventListener){DOMContentLoaded=function(){document.removeEventListener("DOMContentLoaded",DOMContentLoaded,false);jQuery.ready()}}else if(document.attachEvent){DOMContentLoaded=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",DOMContentLoaded);jQuery.ready()}}}function doScrollCheck(){if(jQuery.isReady){return}try{document.documentElement.doScroll("left")}catch(e){setTimeout(doScrollCheck,1);return}jQuery.ready()}return jQuery}();var promiseMethods="done fail isResolved isRejected promise then always pipe".split(" "),sliceDeferred=[].slice;jQuery.extend({_Deferred:function(){var callbacks=[],fired,firing,cancelled,deferred={done:function(){if(!cancelled){var args=arguments,i,length,elem,type,_fired;if(fired){_fired=fired;fired=0}for(i=0,length=args.length;i<length;i++){elem=args[i];type=jQuery.type(elem);if(type==="array"){deferred.done.apply(deferred,elem)}else if(type==="function"){callbacks.push(elem)}}if(_fired){deferred.resolveWith(_fired[0],_fired[1])}}return this},resolveWith:function(context,args){if(!cancelled&&!fired&&!firing){args=args||[];firing=1;try{while(callbacks[0]){callbacks.shift().apply(context,args)}}finally{fired=[context,args];firing=0}}return this},resolve:function(){deferred.resolveWith(this,arguments);return this},isResolved:function(){return!!(firing||fired)},cancel:function(){cancelled=1;callbacks=[];return this}};return deferred},Deferred:function(func){var deferred=jQuery._Deferred(),failDeferred=jQuery._Deferred(),promise;jQuery.extend(deferred,{then:function(doneCallbacks,failCallbacks){deferred.done(doneCallbacks).fail(failCallbacks);return this},always:function(){return deferred.done.apply(deferred,arguments).fail.apply(this,arguments)},fail:failDeferred.done,rejectWith:failDeferred.resolveWith,reject:failDeferred.resolve,isRejected:failDeferred.isResolved,pipe:function(fnDone,fnFail){return jQuery.Deferred(function(newDefer){jQuery.each({done:[fnDone,"resolve"],fail:[fnFail,"reject"]},function(handler,data){var fn=data[0],action=data[1],returned;if(jQuery.isFunction(fn)){deferred[handler](function(){returned=fn.apply(this,arguments);if(jQuery.isFunction(returned.promise)){returned.promise().then(newDefer.resolve,newDefer.reject)}else{newDefer[action](returned)}})}else{deferred[handler](newDefer[action])}})}).promise()},promise:function(obj){if(obj==null){if(promise){return promise}promise=obj={}}var i=promiseMethods.length;while(i--){obj[promiseMethods[i]]=deferred[promiseMethods[i]]}return obj}});deferred.done(failDeferred.cancel).fail(deferred.cancel);delete deferred.cancel;if(func){func.call(deferred,deferred)}return deferred},when:function(firstParam){var args=arguments,i=0,length=args.length,count=length,deferred=length<=1&&firstParam&&jQuery.isFunction(firstParam.promise)?firstParam:jQuery.Deferred();function resolveFunc(i){return function(value){args[i]=arguments.length>1?sliceDeferred.call(arguments,0):value;if(!--count){deferred.resolveWith(deferred,sliceDeferred.call(args,0))}}}if(length>1){for(;i<length;i++){if(args[i]&&jQuery.isFunction(args[i].promise)){args[i].promise().then(resolveFunc(i),deferred.reject)}else{--count}}if(!count){deferred.resolveWith(deferred,args)}}else if(deferred!==firstParam){deferred.resolveWith(deferred,length?[firstParam]:[])}return deferred.promise()}});jQuery.support=function(){var div=document.createElement("div"),all,a,select,opt,input,marginDiv,support,fragment,body,bodyStyle,tds,events,eventName,i,isSupported;div.setAttribute("className","t");div.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";all=div.getElementsByTagName("*");a=div.getElementsByTagName("a")[0];if(!all||!all.length||!a){return{}}select=document.createElement("select");opt=select.appendChild(document.createElement("option"));input=div.getElementsByTagName("input")[0];support={leadingWhitespace:div.firstChild.nodeType===3,tbody:!div.getElementsByTagName("tbody").length,htmlSerialize:!!div.getElementsByTagName("link").length,style:/top/.test(a.getAttribute("style")),hrefNormalized:a.getAttribute("href")==="/a",opacity:/^0.55$/.test(a.style.opacity),cssFloat:!!a.style.cssFloat,checkOn:input.value==="on",optSelected:opt.selected,getSetAttribute:div.className!=="t",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};input.checked=true;support.noCloneChecked=input.cloneNode(true).checked;select.disabled=true;support.optDisabled=!opt.disabled;try{delete div.test}catch(e){support.deleteExpando=false}if(!div.addEventListener&&div.attachEvent&&div.fireEvent){div.attachEvent("onclick",function click(){support.noCloneEvent=false;div.detachEvent("onclick",click)});div.cloneNode(true).fireEvent("onclick")}input=document.createElement("input");input.value="t";input.setAttribute("type","radio");support.radioValue=input.value==="t";input.setAttribute("checked","checked");div.appendChild(input);fragment=document.createDocumentFragment();fragment.appendChild(div.firstChild);support.checkClone=fragment.cloneNode(true).cloneNode(true).lastChild.checked;div.innerHTML="";div.style.width=div.style.paddingLeft="1px";body=document.createElement("body");bodyStyle={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(i in bodyStyle){body.style[i]=bodyStyle[i]}body.appendChild(div);document.documentElement.appendChild(body);support.appendChecked=input.checked;support.boxModel=div.offsetWidth===2;if("zoom"in div.style){div.style.display="inline";div.style.zoom=1;support.inlineBlockNeedsLayout=div.offsetWidth===2;div.style.display="";div.innerHTML="<div style='width:4px;'></div>";support.shrinkWrapBlocks=div.offsetWidth!==2}div.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";tds=div.getElementsByTagName("td");isSupported=tds[0].offsetHeight===0;tds[0].style.display="";tds[1].style.display="none";support.reliableHiddenOffsets=isSupported&&tds[0].offsetHeight===0;div.innerHTML="";if(document.defaultView&&document.defaultView.getComputedStyle){marginDiv=document.createElement("div");marginDiv.style.width="0";marginDiv.style.marginRight="0";div.appendChild(marginDiv);support.reliableMarginRight=(parseInt(document.defaultView.getComputedStyle(marginDiv,null).marginRight,10)||0)===0}body.innerHTML="";document.documentElement.removeChild(body);if(div.attachEvent){for(i in{submit:1,change:1,focusin:1}){eventName="on"+i;isSupported=eventName in div;if(!isSupported){div.setAttribute(eventName,"return;");isSupported=typeof div[eventName]==="function"}support[i+"Bubbles"]=isSupported}}return support}();jQuery.boxModel=jQuery.support.boxModel;var rbrace=/^(?:\{.*\}|\[.*\])$/,rmultiDash=/([a-z])([A-Z])/g;jQuery.extend({cache:{},uuid:0,expando:"jQuery"+(jQuery.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(elem){elem=elem.nodeType?jQuery.cache[elem[jQuery.expando]]:elem[jQuery.expando];return!!elem&&!isEmptyDataObject(elem)},data:function(elem,name,data,pvt){if(!jQuery.acceptData(elem)){return}var internalKey=jQuery.expando,getByName=typeof name==="string",thisCache,isNode=elem.nodeType,cache=isNode?jQuery.cache:elem,id=isNode?elem[jQuery.expando]:elem[jQuery.expando]&&jQuery.expando;if((!id||pvt&&id&&!cache[id][internalKey])&&getByName&&data===undefined){return}if(!id){if(isNode){elem[jQuery.expando]=id=++jQuery.uuid}else{id=jQuery.expando}}if(!cache[id]){cache[id]={};if(!isNode){cache[id].toJSON=jQuery.noop}}if(typeof name==="object"||typeof name==="function"){if(pvt){cache[id][internalKey]=jQuery.extend(cache[id][internalKey],name)}else{cache[id]=jQuery.extend(cache[id],name)}}thisCache=cache[id];if(pvt){if(!thisCache[internalKey]){thisCache[internalKey]={}}thisCache=thisCache[internalKey]}if(data!==undefined){thisCache[name]=data}if(name==="events"&&!thisCache[name]){return thisCache[internalKey]&&thisCache[internalKey].events}return getByName?thisCache[name]:thisCache},removeData:function(elem,name,pvt){if(!jQuery.acceptData(elem)){return}var internalKey=jQuery.expando,isNode=elem.nodeType,cache=isNode?jQuery.cache:elem,id=isNode?elem[jQuery.expando]:jQuery.expando;if(!cache[id]){return}if(name){var thisCache=pvt?cache[id][internalKey]:cache[id];if(thisCache){delete thisCache[name];if(!isEmptyDataObject(thisCache)){return}}}if(pvt){delete cache[id][internalKey];if(!isEmptyDataObject(cache[id])){return}}var internalCache=cache[id][internalKey];if(jQuery.support.deleteExpando||cache!=window){delete cache[id]}else{cache[id]=null}if(internalCache){cache[id]={};if(!isNode){cache[id].toJSON=jQuery.noop}cache[id][internalKey]=internalCache}else if(isNode){if(jQuery.support.deleteExpando){delete elem[jQuery.expando]}else if(elem.removeAttribute){elem.removeAttribute(jQuery.expando)}else{elem[jQuery.expando]=null}}},_data:function(elem,name,data){return jQuery.data(elem,name,data,true)},acceptData:function(elem){if(elem.nodeName){var match=jQuery.noData[elem.nodeName.toLowerCase()];if(match){return!(match===true||elem.getAttribute("classid")!==match)}}return true}});jQuery.fn.extend({data:function(key,value){var data=null;if(typeof key==="undefined"){if(this.length){data=jQuery.data(this[0]);if(this[0].nodeType===1){var attr=this[0].attributes,name;for(var i=0,l=attr.length;i<l;i++){name=attr[i].name;if(name.indexOf("data-")===0){name=jQuery.camelCase(name.substring(5));dataAttr(this[0],name,data[name])}}}}return data}else if(typeof key==="object"){return this.each(function(){jQuery.data(this,key)})}var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length){data=jQuery.data(this[0],key);data=dataAttr(this[0],key,data)}return data===undefined&&parts[1]?this.data(parts[0]):data}else{return this.each(function(){var $this=jQuery(this),args=[parts[0],value];$this.triggerHandler("setData"+parts[1]+"!",args);jQuery.data(this,key,value);$this.triggerHandler("changeData"+parts[1]+"!",args)})}},removeData:function(key){return this.each(function(){jQuery.removeData(this,key)})}});function dataAttr(elem,key,data){if(data===undefined&&elem.nodeType===1){name="data-"+key.replace(rmultiDash,"$1-$2").toLowerCase();data=elem.getAttribute(name);if(typeof data==="string"){try{data=data==="true"?true:data==="false"?false:data==="null"?null:!jQuery.isNaN(data)?parseFloat(data):rbrace.test(data)?jQuery.parseJSON(data):data}catch(e){}jQuery.data(elem,key,data)}else{data=undefined}}return data}function isEmptyDataObject(obj){for(var name in obj){if(name!=="toJSON"){return false}}return true}function handleQueueMarkDefer(elem,type,src){var deferDataKey=type+"defer",queueDataKey=type+"queue",markDataKey=type+"mark",defer=jQuery.data(elem,deferDataKey,undefined,true);if(defer&&(src==="queue"||!jQuery.data(elem,queueDataKey,undefined,true))&&(src==="mark"||!jQuery.data(elem,markDataKey,undefined,true))){setTimeout(function(){if(!jQuery.data(elem,queueDataKey,undefined,true)&&!jQuery.data(elem,markDataKey,undefined,true)){jQuery.removeData(elem,deferDataKey,true);defer.resolve()}},0)}}jQuery.extend({_mark:function(elem,type){if(elem){type=(type||"fx")+"mark";jQuery.data(elem,type,(jQuery.data(elem,type,undefined,true)||0)+1,true)}},_unmark:function(force,elem,type){if(force!==true){type=elem;elem=force;force=false}if(elem){type=type||"fx";var key=type+"mark",count=force?0:(jQuery.data(elem,key,undefined,true)||1)-1;if(count){jQuery.data(elem,key,count,true)}else{jQuery.removeData(elem,key,true);handleQueueMarkDefer(elem,type,"mark")}}},queue:function(elem,type,data){if(elem){type=(type||"fx")+"queue";var q=jQuery.data(elem,type,undefined,true);if(data){if(!q||jQuery.isArray(data)){q=jQuery.data(elem,type,jQuery.makeArray(data),true)}else{q.push(data)}}return q||[]}},dequeue:function(elem,type){type=type||"fx";var queue=jQuery.queue(elem,type),fn=queue.shift(),defer;if(fn==="inprogress"){fn=queue.shift()}if(fn){if(type==="fx"){queue.unshift("inprogress")}fn.call(elem,function(){jQuery.dequeue(elem,type)})}if(!queue.length){jQuery.removeData(elem,type+"queue",true);handleQueueMarkDefer(elem,type,"queue")}}});jQuery.fn.extend({queue:function(type,data){if(typeof type!=="string"){data=type;type="fx"}if(data===undefined){return jQuery.queue(this[0],type)}return this.each(function(){var queue=jQuery.queue(this,type,data);if(type==="fx"&&queue[0]!=="inprogress"){jQuery.dequeue(this,type)}})},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type)})},delay:function(time,type){time=jQuery.fx?jQuery.fx.speeds[time]||time:time;type=type||"fx";return this.queue(type,function(){var elem=this;setTimeout(function(){jQuery.dequeue(elem,type)},time)})},clearQueue:function(type){return this.queue(type||"fx",[])},promise:function(type,object){if(typeof type!=="string"){object=type;type=undefined}type=type||"fx";var defer=jQuery.Deferred(),elements=this,i=elements.length,count=1,deferDataKey=type+"defer",queueDataKey=type+"queue",markDataKey=type+"mark";function resolve(){if(!--count){defer.resolveWith(elements,[elements])}}while(i--){if(tmp=jQuery.data(elements[i],deferDataKey,undefined,true)||(jQuery.data(elements[i],queueDataKey,undefined,true)||jQuery.data(elements[i],markDataKey,undefined,true))&&jQuery.data(elements[i],deferDataKey,jQuery._Deferred(),true)){count++;tmp.done(resolve)}}resolve();return defer.promise()}});var rclass=/[\n\t\r]/g,rspace=/\s+/,rreturn=/\r/g,rtype=/^(?:button|input)$/i,rfocusable=/^(?:button|input|object|select|textarea)$/i,rclickable=/^a(?:rea)?$/i,rspecial=/^(?:data-|aria-)/,rinvalidChar=/\:/,formHook;jQuery.fn.extend({attr:function(name,value){return jQuery.access(this,name,value,true,jQuery.attr)},removeAttr:function(name){return this.each(function(){jQuery.removeAttr(this,name)})},prop:function(name,value){return jQuery.access(this,name,value,true,jQuery.prop)},removeProp:function(name){return this.each(function(){try{this[name]=undefined;delete this[name]}catch(e){}})},addClass:function(value){if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);self.addClass(value.call(this,i,self.attr("class")||""))})}if(value&&typeof value==="string"){var classNames=(value||"").split(rspace);for(var i=0,l=this.length;i<l;i++){var elem=this[i];if(elem.nodeType===1){if(!elem.className){elem.className=value}else{var className=" "+elem.className+" ",setClass=elem.className;for(var c=0,cl=classNames.length;c<cl;c++){if(className.indexOf(" "+classNames[c]+" ")<0){setClass+=" "+classNames[c]}}elem.className=jQuery.trim(setClass)}}}}return this},removeClass:function(value){if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);self.removeClass(value.call(this,i,self.attr("class")))})}if(value&&typeof value==="string"||value===undefined){var classNames=(value||"").split(rspace);for(var i=0,l=this.length;i<l;i++){var elem=this[i];if(elem.nodeType===1&&elem.className){if(value){var className=(" "+elem.className+" ").replace(rclass," ");for(var c=0,cl=classNames.length;c<cl;c++){className=className.replace(" "+classNames[c]+" "," ")}elem.className=jQuery.trim(className)}else{elem.className=""}}}}return this},toggleClass:function(value,stateVal){var type=typeof value,isBool=typeof stateVal==="boolean";if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);self.toggleClass(value.call(this,i,self.attr("class"),stateVal),stateVal)})}return this.each(function(){if(type==="string"){var className,i=0,self=jQuery(this),state=stateVal,classNames=value.split(rspace);while(className=classNames[i++]){state=isBool?state:!self.hasClass(className);self[state?"addClass":"removeClass"](className)}}else if(type==="undefined"||type==="boolean"){if(this.className){jQuery._data(this,"__className__",this.className)}this.className=this.className||value===false?"":jQuery._data(this,"__className__")||""}})},hasClass:function(selector){var className=" "+selector+" ";for(var i=0,l=this.length;i<l;i++){if((" "+this[i].className+" ").replace(rclass," ").indexOf(className)>-1){return true}}return false},val:function(value){var hooks,ret,elem=this[0];if(!arguments.length){if(elem){hooks=jQuery.valHooks[elem.nodeName.toLowerCase()]||jQuery.valHooks[elem.type];if(hooks&&"get"in hooks&&(ret=hooks.get(elem,"value"))!==undefined){return ret}return(elem.value||"").replace(rreturn,"")}return undefined}var isFunction=jQuery.isFunction(value);return this.each(function(i){var self=jQuery(this),val;if(this.nodeType!==1){return}if(isFunction){val=value.call(this,i,self.val())}else{val=value}if(val==null){val=""}else if(typeof val==="number"){val+=""}else if(jQuery.isArray(val)){val=jQuery.map(val,function(value){return value==null?"":value+""})}hooks=jQuery.valHooks[this.nodeName.toLowerCase()]||jQuery.valHooks[this.type];if(!hooks||"set"in hooks&&hooks.set(this,val,"value")===undefined){this.value=val}})}});jQuery.extend({valHooks:{option:{get:function(elem){var val=elem.attributes.value;return!val||val.specified?elem.value:elem.text}},select:{get:function(elem){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type==="select-one";if(index<0){return null}for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected&&(jQuery.support.optDisabled?!option.disabled:option.getAttribute("disabled")===null)&&(!option.parentNode.disabled||!jQuery.nodeName(option.parentNode,"optgroup"))){value=jQuery(option).val();if(one){return value}values.push(value)}}if(one&&!values.length&&options.length){return jQuery(options[index]).val()}return values},set:function(elem,value){var values=jQuery.makeArray(value);jQuery(elem).find("option").each(function(){this.selected=jQuery.inArray(jQuery(this).val(),values)>=0});if(!values.length){elem.selectedIndex=-1}return values}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attrFix:{tabindex:"tabIndex",readonly:"readOnly"},attr:function(elem,name,value,pass){var nType=elem.nodeType;if(!elem||nType===3||nType===8||nType===2){return undefined}if(pass&&name in jQuery.attrFn){return jQuery(elem)[name](value)}var ret,hooks,notxml=nType!==1||!jQuery.isXMLDoc(elem);name=notxml&&jQuery.attrFix[name]||name;hooks=jQuery.attrHooks[name]||(formHook&&(jQuery.nodeName(elem,"form")||rinvalidChar.test(name))?formHook:undefined);if(value!==undefined){if(value===null||value===false&&!rspecial.test(name)){jQuery.removeAttr(elem,name);return undefined}else if(hooks&&"set"in hooks&¬xml&&(ret=hooks.set(elem,value,name))!==undefined){return ret}else{if(value===true&&!rspecial.test(name)){value=name}elem.setAttribute(name,""+value);return value}}else{if(hooks&&"get"in hooks&¬xml){return hooks.get(elem,name)}else{ret=elem.getAttribute(name);return ret===null?undefined:ret}}},removeAttr:function(elem,name){if(elem.nodeType===1){name=jQuery.attrFix[name]||name;if(jQuery.support.getSetAttribute){elem.removeAttribute(name)}else{jQuery.attr(elem,name,"");elem.removeAttributeNode(elem.getAttributeNode(name))}}},attrHooks:{type:{set:function(elem,value){if(rtype.test(elem.nodeName)&&elem.parentNode){jQuery.error("type property can't be changed")}else if(!jQuery.support.radioValue&&value==="radio"&&jQuery.nodeName(elem,"input")){var val=elem.getAttribute("value");elem.setAttribute("type",value);if(val){elem.value=val}return value}}},tabIndex:{get:function(elem){var attributeNode=elem.getAttributeNode("tabIndex");return attributeNode&&attributeNode.specified?parseInt(attributeNode.value,10):rfocusable.test(elem.nodeName)||rclickable.test(elem.nodeName)&&elem.href?0:undefined;
}}},propFix:{},prop:function(elem,name,value){var nType=elem.nodeType;if(!elem||nType===3||nType===8||nType===2){return undefined}var ret,hooks,notxml=nType!==1||!jQuery.isXMLDoc(elem);name=notxml&&jQuery.propFix[name]||name;hooks=jQuery.propHooks[name];if(value!==undefined){if(hooks&&"set"in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret}else{return elem[name]=value}}else{if(hooks&&"get"in hooks&&(ret=hooks.get(elem,name))!==undefined){return ret}else{return elem[name]}}},propHooks:{}});if(!jQuery.support.getSetAttribute){jQuery.attrFix=jQuery.extend(jQuery.attrFix,{"for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder"});formHook=jQuery.attrHooks.name=jQuery.attrHooks.value=jQuery.valHooks.button={get:function(elem,name){var ret;if(name==="value"&&!jQuery.nodeName(elem,"button")){return elem.getAttribute(name)}ret=elem.getAttributeNode(name);return ret&&ret.specified?ret.nodeValue:undefined},set:function(elem,value,name){var ret=elem.getAttributeNode(name);if(ret){ret.nodeValue=value;return value}}};jQuery.each(["width","height"],function(i,name){jQuery.attrHooks[name]=jQuery.extend(jQuery.attrHooks[name],{set:function(elem,value){if(value===""){elem.setAttribute(name,"auto");return value}}})})}if(!jQuery.support.hrefNormalized){jQuery.each(["href","src","width","height"],function(i,name){jQuery.attrHooks[name]=jQuery.extend(jQuery.attrHooks[name],{get:function(elem){var ret=elem.getAttribute(name,2);return ret===null?undefined:ret}})})}if(!jQuery.support.style){jQuery.attrHooks.style={get:function(elem){return elem.style.cssText.toLowerCase()||undefined},set:function(elem,value){return elem.style.cssText=""+value}}}if(!jQuery.support.optSelected){jQuery.propHooks.selected=jQuery.extend(jQuery.propHooks.selected,{get:function(elem){var parent=elem.parentNode;if(parent){parent.selectedIndex;if(parent.parentNode){parent.parentNode.selectedIndex}}}})}if(!jQuery.support.checkOn){jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]={get:function(elem){return elem.getAttribute("value")===null?"on":elem.value}}})}jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]=jQuery.extend(jQuery.valHooks[this],{set:function(elem,value){if(jQuery.isArray(value)){return elem.checked=jQuery.inArray(jQuery(elem).val(),value)>=0}}})});var hasOwn=Object.prototype.hasOwnProperty,rnamespaces=/\.(.*)$/,rformElems=/^(?:textarea|input|select)$/i,rperiod=/\./g,rspaces=/ /g,rescape=/[^\w\s.|`]/g,fcleanup=function(nm){return nm.replace(rescape,"\\$&")};jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType===3||elem.nodeType===8){return}if(handler===false){handler=returnFalse}else if(!handler){return}var handleObjIn,handleObj;if(handler.handler){handleObjIn=handler;handler=handleObjIn.handler}if(!handler.guid){handler.guid=jQuery.guid++}var elemData=jQuery._data(elem);if(!elemData){return}var events=elemData.events,eventHandle=elemData.handle;if(!events){elemData.events=events={}}if(!eventHandle){elemData.handle=eventHandle=function(e){return typeof jQuery!=="undefined"&&(!e||jQuery.event.triggered!==e.type)?jQuery.event.handle.apply(eventHandle.elem,arguments):undefined}}eventHandle.elem=elem;types=types.split(" ");var type,i=0,namespaces;while(type=types[i++]){handleObj=handleObjIn?jQuery.extend({},handleObjIn):{handler:handler,data:data};if(type.indexOf(".")>-1){namespaces=type.split(".");type=namespaces.shift();handleObj.namespace=namespaces.slice(0).sort().join(".")}else{namespaces=[];handleObj.namespace=""}handleObj.type=type;if(!handleObj.guid){handleObj.guid=handler.guid}var handlers=events[type],special=jQuery.event.special[type]||{};if(!handlers){handlers=events[type]=[];if(!special.setup||special.setup.call(elem,data,namespaces,eventHandle)===false){if(elem.addEventListener){elem.addEventListener(type,eventHandle,false)}else if(elem.attachEvent){elem.attachEvent("on"+type,eventHandle)}}}if(special.add){special.add.call(elem,handleObj);if(!handleObj.handler.guid){handleObj.handler.guid=handler.guid}}handlers.push(handleObj);jQuery.event.global[type]=true}elem=null},global:{},remove:function(elem,types,handler,pos){if(elem.nodeType===3||elem.nodeType===8){return}if(handler===false){handler=returnFalse}var ret,type,fn,j,i=0,all,namespaces,namespace,special,eventType,handleObj,origType,elemData=jQuery.hasData(elem)&&jQuery._data(elem),events=elemData&&elemData.events;if(!elemData||!events){return}if(types&&types.type){handler=types.handler;types=types.type}if(!types||typeof types==="string"&&types.charAt(0)==="."){types=types||"";for(type in events){jQuery.event.remove(elem,type+types)}return}types=types.split(" ");while(type=types[i++]){origType=type;handleObj=null;all=type.indexOf(".")<0;namespaces=[];if(!all){namespaces=type.split(".");type=namespaces.shift();namespace=new RegExp("(^|\\.)"+jQuery.map(namespaces.slice(0).sort(),fcleanup).join("\\.(?:.*\\.)?")+"(\\.|$)")}eventType=events[type];if(!eventType){continue}if(!handler){for(j=0;j<eventType.length;j++){handleObj=eventType[j];if(all||namespace.test(handleObj.namespace)){jQuery.event.remove(elem,origType,handleObj.handler,j);eventType.splice(j--,1)}}continue}special=jQuery.event.special[type]||{};for(j=pos||0;j<eventType.length;j++){handleObj=eventType[j];if(handler.guid===handleObj.guid){if(all||namespace.test(handleObj.namespace)){if(pos==null){eventType.splice(j--,1)}if(special.remove){special.remove.call(elem,handleObj)}}if(pos!=null){break}}}if(eventType.length===0||pos!=null&&eventType.length===1){if(!special.teardown||special.teardown.call(elem,namespaces)===false){jQuery.removeEvent(elem,type,elemData.handle)}ret=null;delete events[type]}}if(jQuery.isEmptyObject(events)){var handle=elemData.handle;if(handle){handle.elem=null}delete elemData.events;delete elemData.handle;if(jQuery.isEmptyObject(elemData)){jQuery.removeData(elem,undefined,true)}}},customEvent:{getData:true,setData:true,changeData:true},trigger:function(event,data,elem,onlyHandlers){var type=event.type||event,namespaces=[],exclusive;if(type.indexOf("!")>=0){type=type.slice(0,-1);exclusive=true}if(type.indexOf(".")>=0){namespaces=type.split(".");type=namespaces.shift();namespaces.sort()}if((!elem||jQuery.event.customEvent[type])&&!jQuery.event.global[type]){return}event=typeof event==="object"?event[jQuery.expando]?event:new jQuery.Event(type,event):new jQuery.Event(type);event.type=type;event.exclusive=exclusive;event.namespace=namespaces.join(".");event.namespace_re=new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.)?")+"(\\.|$)");if(onlyHandlers||!elem){event.preventDefault();event.stopPropagation()}if(!elem){jQuery.each(jQuery.cache,function(){var internalKey=jQuery.expando,internalCache=this[internalKey];if(internalCache&&internalCache.events&&internalCache.events[type]){jQuery.event.trigger(event,data,internalCache.handle.elem)}});return}if(elem.nodeType===3||elem.nodeType===8){return}event.result=undefined;event.target=elem;data=data?jQuery.makeArray(data):[];data.unshift(event);var cur=elem,ontype=type.indexOf(":")<0?"on"+type:"";do{var handle=jQuery._data(cur,"handle");event.currentTarget=cur;if(handle){handle.apply(cur,data)}if(ontype&&jQuery.acceptData(cur)&&cur[ontype]&&cur[ontype].apply(cur,data)===false){event.result=false;event.preventDefault()}cur=cur.parentNode||cur.ownerDocument||cur===event.target.ownerDocument&&window}while(cur&&!event.isPropagationStopped());if(!event.isDefaultPrevented()){var old,special=jQuery.event.special[type]||{};if((!special._default||special._default.call(elem.ownerDocument,event)===false)&&!(type==="click"&&jQuery.nodeName(elem,"a"))&&jQuery.acceptData(elem)){try{if(ontype&&elem[type]){old=elem[ontype];if(old){elem[ontype]=null}jQuery.event.triggered=type;elem[type]()}}catch(ieError){}if(old){elem[ontype]=old}jQuery.event.triggered=undefined}}return event.result},handle:function(event){event=jQuery.event.fix(event||window.event);var handlers=((jQuery._data(this,"events")||{})[event.type]||[]).slice(0),run_all=!event.exclusive&&!event.namespace,args=Array.prototype.slice.call(arguments,0);args[0]=event;event.currentTarget=this;for(var j=0,l=handlers.length;j<l;j++){var handleObj=handlers[j];if(run_all||event.namespace_re.test(handleObj.namespace)){event.handler=handleObj.handler;event.data=handleObj.data;event.handleObj=handleObj;var ret=handleObj.handler.apply(this,args);if(ret!==undefined){event.result=ret;if(ret===false){event.preventDefault();event.stopPropagation()}}if(event.isImmediatePropagationStopped()){break}}}return event.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(event){if(event[jQuery.expando]){return event}var originalEvent=event;event=jQuery.Event(originalEvent);for(var i=this.props.length,prop;i;){prop=this.props[--i];event[prop]=originalEvent[prop]}if(!event.target){event.target=event.srcElement||document}if(event.target.nodeType===3){event.target=event.target.parentNode}if(!event.relatedTarget&&event.fromElement){event.relatedTarget=event.fromElement===event.target?event.toElement:event.fromElement}if(event.pageX==null&&event.clientX!=null){var eventDocument=event.target.ownerDocument||document,doc=eventDocument.documentElement,body=eventDocument.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0)}if(event.which==null&&(event.charCode!=null||event.keyCode!=null)){event.which=event.charCode!=null?event.charCode:event.keyCode}if(!event.metaKey&&event.ctrlKey){event.metaKey=event.ctrlKey}if(!event.which&&event.button!==undefined){event.which=event.button&1?1:event.button&2?3:event.button&4?2:0}return event},guid:1e8,proxy:jQuery.proxy,special:{ready:{setup:jQuery.bindReady,teardown:jQuery.noop},live:{add:function(handleObj){jQuery.event.add(this,liveConvert(handleObj.origType,handleObj.selector),jQuery.extend({},handleObj,{handler:liveHandler,guid:handleObj.handler.guid}))},remove:function(handleObj){jQuery.event.remove(this,liveConvert(handleObj.origType,handleObj.selector),handleObj)}},beforeunload:{setup:function(data,namespaces,eventHandle){if(jQuery.isWindow(this)){this.onbeforeunload=eventHandle}},teardown:function(namespaces,eventHandle){if(this.onbeforeunload===eventHandle){this.onbeforeunload=null}}}}};jQuery.removeEvent=document.removeEventListener?function(elem,type,handle){if(elem.removeEventListener){elem.removeEventListener(type,handle,false)}}:function(elem,type,handle){if(elem.detachEvent){elem.detachEvent("on"+type,handle)}};jQuery.Event=function(src,props){if(!this.preventDefault){return new jQuery.Event(src,props)}if(src&&src.type){this.originalEvent=src;this.type=src.type;this.isDefaultPrevented=src.defaultPrevented||src.returnValue===false||src.getPreventDefault&&src.getPreventDefault()?returnTrue:returnFalse}else{this.type=src}if(props){jQuery.extend(this,props)}this.timeStamp=jQuery.now();this[jQuery.expando]=true};function returnFalse(){return false}function returnTrue(){return true}jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;var e=this.originalEvent;if(!e){return}if(e.preventDefault){e.preventDefault()}else{e.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=returnTrue;var e=this.originalEvent;if(!e){return}if(e.stopPropagation){e.stopPropagation()}e.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;this.stopPropagation()},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};var withinElement=function(event){var parent=event.relatedTarget;try{if(parent&&parent!==document&&!parent.parentNode){return}while(parent&&parent!==this){parent=parent.parentNode}if(parent!==this){event.type=event.data;jQuery.event.handle.apply(this,arguments)}}catch(e){}},delegate=function(event){event.type=event.data;jQuery.event.handle.apply(this,arguments)};jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(orig,fix){jQuery.event.special[orig]={setup:function(data){jQuery.event.add(this,fix,data&&data.selector?delegate:withinElement,orig)},teardown:function(data){jQuery.event.remove(this,fix,data&&data.selector?delegate:withinElement)}}});if(!jQuery.support.submitBubbles){jQuery.event.special.submit={setup:function(data,namespaces){if(!jQuery.nodeName(this,"form")){jQuery.event.add(this,"click.specialSubmit",function(e){var elem=e.target,type=elem.type;if((type==="submit"||type==="image")&&jQuery(elem).closest("form").length){trigger("submit",this,arguments)}});jQuery.event.add(this,"keypress.specialSubmit",function(e){var elem=e.target,type=elem.type;if((type==="text"||type==="password")&&jQuery(elem).closest("form").length&&e.keyCode===13){trigger("submit",this,arguments)}})}else{return false}},teardown:function(namespaces){jQuery.event.remove(this,".specialSubmit")}}}if(!jQuery.support.changeBubbles){var changeFilters,getVal=function(elem){var type=elem.type,val=elem.value;if(type==="radio"||type==="checkbox"){val=elem.checked}else if(type==="select-multiple"){val=elem.selectedIndex>-1?jQuery.map(elem.options,function(elem){return elem.selected}).join("-"):""}else if(jQuery.nodeName(elem,"select")){val=elem.selectedIndex}return val},testChange=function testChange(e){var elem=e.target,data,val;if(!rformElems.test(elem.nodeName)||elem.readOnly){return}data=jQuery._data(elem,"_change_data");val=getVal(elem);if(e.type!=="focusout"||elem.type!=="radio"){jQuery._data(elem,"_change_data",val)}if(data===undefined||val===data){return}if(data!=null||val){e.type="change";e.liveFired=undefined;jQuery.event.trigger(e,arguments[1],elem)}};jQuery.event.special.change={filters:{focusout:testChange,beforedeactivate:testChange,click:function(e){var elem=e.target,type=jQuery.nodeName(elem,"input")?elem.type:"";if(type==="radio"||type==="checkbox"||jQuery.nodeName(elem,"select")){testChange.call(this,e)}},keydown:function(e){var elem=e.target,type=jQuery.nodeName(elem,"input")?elem.type:"";if(e.keyCode===13&&!jQuery.nodeName(elem,"textarea")||e.keyCode===32&&(type==="checkbox"||type==="radio")||type==="select-multiple"){testChange.call(this,e)}},beforeactivate:function(e){var elem=e.target;jQuery._data(elem,"_change_data",getVal(elem))}},setup:function(data,namespaces){if(this.type==="file"){return false}for(var type in changeFilters){jQuery.event.add(this,type+".specialChange",changeFilters[type])}return rformElems.test(this.nodeName)},teardown:function(namespaces){jQuery.event.remove(this,".specialChange");return rformElems.test(this.nodeName)}};changeFilters=jQuery.event.special.change.filters;changeFilters.focus=changeFilters.beforeactivate}function trigger(type,elem,args){var event=jQuery.extend({},args[0]);event.type=type;event.originalEvent={};event.liveFired=undefined;jQuery.event.handle.call(elem,event);if(event.isDefaultPrevented()){args[0].preventDefault()}}if(!jQuery.support.focusinBubbles){jQuery.each({focus:"focusin",blur:"focusout"},function(orig,fix){var attaches=0;jQuery.event.special[fix]={setup:function(){if(attaches++===0){document.addEventListener(orig,handler,true)}},teardown:function(){if(--attaches===0){document.removeEventListener(orig,handler,true)}}};function handler(donor){var e=jQuery.event.fix(donor);e.type=fix;e.originalEvent={};jQuery.event.trigger(e,null,e.target);if(e.isDefaultPrevented()){donor.preventDefault()}}})}jQuery.each(["bind","one"],function(i,name){jQuery.fn[name]=function(type,data,fn){var handler;if(typeof type==="object"){for(var key in type){this[name](key,data,type[key],fn)}return this}if(arguments.length===2||data===false){fn=data;data=undefined}if(name==="one"){handler=function(event){jQuery(this).unbind(event,handler);return fn.apply(this,arguments)};handler.guid=fn.guid||jQuery.guid++}else{handler=fn}if(type==="unload"&&name!=="one"){this.one(type,data,fn)}else{for(var i=0,l=this.length;i<l;i++){jQuery.event.add(this[i],type,handler,data)}}return this}});jQuery.fn.extend({unbind:function(type,fn){if(typeof type==="object"&&!type.preventDefault){for(var key in type){this.unbind(key,type[key])}}else{for(var i=0,l=this.length;i<l;i++){jQuery.event.remove(this[i],type,fn)}}return this},delegate:function(selector,types,data,fn){return this.live(types,data,fn,selector)},undelegate:function(selector,types,fn){if(arguments.length===0){return this.unbind("live")}else{return this.die(types,null,fn,selector)}},trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this)})},triggerHandler:function(type,data){if(this[0]){return jQuery.event.trigger(type,data,this[0],true)}},toggle:function(fn){var args=arguments,guid=fn.guid||jQuery.guid++,i=0,toggler=function(event){var lastToggle=(jQuery.data(this,"lastToggle"+fn.guid)||0)%i;jQuery.data(this,"lastToggle"+fn.guid,lastToggle+1);event.preventDefault();return args[lastToggle].apply(this,arguments)||false};toggler.guid=guid;while(i<args.length){args[i++].guid=guid}return this.click(toggler)},hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut||fnOver)}});var liveMap={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};jQuery.each(["live","die"],function(i,name){jQuery.fn[name]=function(types,data,fn,origSelector){var type,i=0,match,namespaces,preType,selector=origSelector||this.selector,context=origSelector?this:jQuery(this.context);if(typeof types==="object"&&!types.preventDefault){for(var key in types){context[name](key,data,types[key],selector)}return this}if(name==="die"&&!types&&origSelector&&origSelector.charAt(0)==="."){context.unbind(origSelector);return this}if(data===false||jQuery.isFunction(data)){fn=data||returnFalse;data=undefined}types=(types||"").split(" ");while((type=types[i++])!=null){match=rnamespaces.exec(type);namespaces="";if(match){namespaces=match[0];type=type.replace(rnamespaces,"")}if(type==="hover"){types.push("mouseenter"+namespaces,"mouseleave"+namespaces);continue}preType=type;if(liveMap[type]){types.push(liveMap[type]+namespaces);type=type+namespaces}else{type=(liveMap[type]||type)+namespaces}if(name==="live"){for(var j=0,l=context.length;j<l;j++){jQuery.event.add(context[j],"live."+liveConvert(type,selector),{data:data,selector:selector,handler:fn,origType:type,origHandler:fn,preType:preType})}}else{context.unbind("live."+liveConvert(type,selector),fn)}}return this}});function liveHandler(event){var stop,maxLevel,related,match,handleObj,elem,j,i,l,data,close,namespace,ret,elems=[],selectors=[],events=jQuery._data(this,"events");if(event.liveFired===this||!events||!events.live||event.target.disabled||event.button&&event.type==="click"){return}if(event.namespace){namespace=new RegExp("(^|\\.)"+event.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")}event.liveFired=this;var live=events.live.slice(0);for(j=0;j<live.length;j++){handleObj=live[j];if(handleObj.origType.replace(rnamespaces,"")===event.type){selectors.push(handleObj.selector)}else{live.splice(j--,1)}}match=jQuery(event.target).closest(selectors,event.currentTarget);for(i=0,l=match.length;i<l;i++){close=match[i];for(j=0;j<live.length;j++){handleObj=live[j];if(close.selector===handleObj.selector&&(!namespace||namespace.test(handleObj.namespace))&&!close.elem.disabled){elem=close.elem;related=null;if(handleObj.preType==="mouseenter"||handleObj.preType==="mouseleave"){event.type=handleObj.preType;related=jQuery(event.relatedTarget).closest(handleObj.selector)[0];if(related&&jQuery.contains(elem,related)){related=elem}}if(!related||related!==elem){elems.push({elem:elem,handleObj:handleObj,level:close.level})}}}}for(i=0,l=elems.length;i<l;i++){match=elems[i];if(maxLevel&&match.level>maxLevel){break}event.currentTarget=match.elem;event.data=match.handleObj.data;event.handleObj=match.handleObj;ret=match.handleObj.origHandler.apply(match.elem,arguments);if(ret===false||event.isPropagationStopped()){maxLevel=match.level;if(ret===false){stop=false}if(event.isImmediatePropagationStopped()){break}}}return stop}function liveConvert(type,selector){return(type&&type!=="*"?type+".":"")+selector.replace(rperiod,"`").replace(rspaces,"&")}jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick "+"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave "+"change select submit keydown keypress keyup error").split(" "),function(i,name){jQuery.fn[name]=function(data,fn){if(fn==null){fn=data;data=null}return arguments.length>0?this.bind(name,data,fn):this.trigger(name)};if(jQuery.attrFn){jQuery.attrFn[name]=true}});(function(){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,done=0,toString=Object.prototype.toString,hasDuplicate=false,baseHasDuplicate=true,rBackslash=/\\/g,rNonWord=/\W/;[0,0].sort(function(){baseHasDuplicate=false;return 0});var Sizzle=function(selector,context,results,seed){results=results||[];context=context||document;var origContext=context;if(context.nodeType!==1&&context.nodeType!==9){return[]}if(!selector||typeof selector!=="string"){return results}var m,set,checkSet,extra,ret,cur,pop,i,prune=true,contextXML=Sizzle.isXML(context),parts=[],soFar=selector;do{chunker.exec("");m=chunker.exec(soFar);if(m){soFar=m[3];parts.push(m[1]);if(m[2]){extra=m[3];break}}}while(m);if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context)}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);while(parts.length){selector=parts.shift();if(Expr.relative[selector]){selector+=parts.shift()}set=posProcess(selector,set)}}}else{if(!seed&&parts.length>1&&context.nodeType===9&&!contextXML&&Expr.match.ID.test(parts[0])&&!Expr.match.ID.test(parts[parts.length-1])){ret=Sizzle.find(parts.shift(),context,contextXML);context=ret.expr?Sizzle.filter(ret.expr,ret.set)[0]:ret.set[0]}if(context){ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&(parts[0]==="~"||parts[0]==="+")&&context.parentNode?context.parentNode:context,contextXML);set=ret.expr?Sizzle.filter(ret.expr,ret.set):ret.set;if(parts.length>0){checkSet=makeArray(set)}else{prune=false}while(parts.length){cur=parts.pop();pop=cur;if(!Expr.relative[cur]){cur=""}else{pop=parts.pop()}if(pop==null){pop=context}Expr.relative[cur](checkSet,pop,contextXML)}}else{checkSet=parts=[]}}if(!checkSet){checkSet=set}if(!checkSet){Sizzle.error(cur||selector)}if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet)}else if(context&&context.nodeType===1){for(i=0;checkSet[i]!=null;i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&Sizzle.contains(context,checkSet[i]))){results.push(set[i])}}}else{for(i=0;checkSet[i]!=null;i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i])}}}}else{makeArray(checkSet,results)}if(extra){Sizzle(extra,origContext,results,seed);Sizzle.uniqueSort(results)}return results};Sizzle.uniqueSort=function(results){if(sortOrder){hasDuplicate=baseHasDuplicate;results.sort(sortOrder);if(hasDuplicate){for(var i=1;i<results.length;i++){if(results[i]===results[i-1]){results.splice(i--,1)}}}}return results};Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set)};Sizzle.matchesSelector=function(node,expr){return Sizzle(expr,null,null,[node]).length>0};Sizzle.find=function(expr,context,isXML){var set;if(!expr){return[]}for(var i=0,l=Expr.order.length;i<l;i++){var match,type=Expr.order[i];if(match=Expr.leftMatch[type].exec(expr)){var left=match[1];match.splice(1,1);if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(rBackslash,"");set=Expr.find[type](match,context,isXML);if(set!=null){expr=expr.replace(Expr.match[type],"");break}}}}if(!set){set=typeof context.getElementsByTagName!=="undefined"?context.getElementsByTagName("*"):[]}return{set:set,expr:expr}};Sizzle.filter=function(expr,set,inplace,not){var match,anyFound,old=expr,result=[],curLoop=set,isXMLFilter=set&&set[0]&&Sizzle.isXML(set[0]);while(expr&&set.length){for(var type in Expr.filter){if((match=Expr.leftMatch[type].exec(expr))!=null&&match[2]){var found,item,filter=Expr.filter[type],left=match[1];anyFound=false;match.splice(1,1);if(left.substr(left.length-1)==="\\"){continue}if(curLoop===result){result=[]}if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not,isXMLFilter);if(!match){anyFound=found=true}else if(match===true){continue}}if(match){for(var i=0;(item=curLoop[i])!=null;i++){if(item){found=filter(item,match,i,curLoop);var pass=not^!!found;if(inplace&&found!=null){if(pass){anyFound=true}else{curLoop[i]=false}}else if(pass){result.push(item);anyFound=true}}}}if(found!==undefined){if(!inplace){curLoop=result}expr=expr.replace(Expr.match[type],"");if(!anyFound){return[]}break}}}if(expr===old){if(anyFound==null){Sizzle.error(expr)}else{break}}old=expr}return curLoop};Sizzle.error=function(msg){throw"Syntax error, unrecognized expression: "+msg};var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href")},type:function(elem){return elem.getAttribute("type")}},relative:{"+":function(checkSet,part){var isPartStr=typeof part==="string",isTag=isPartStr&&!rNonWord.test(part),isPartStrNotTag=isPartStr&&!isTag;if(isTag){part=part.toLowerCase()}for(var i=0,l=checkSet.length,elem;i<l;i++){if(elem=checkSet[i]){while((elem=elem.previousSibling)&&elem.nodeType!==1){}checkSet[i]=isPartStrNotTag||elem&&elem.nodeName.toLowerCase()===part?elem||false:elem===part}}if(isPartStrNotTag){Sizzle.filter(part,checkSet,true)}},">":function(checkSet,part){var elem,isPartStr=typeof part==="string",i=0,l=checkSet.length;if(isPartStr&&!rNonWord.test(part)){part=part.toLowerCase();for(;i<l;i++){elem=checkSet[i];if(elem){var parent=elem.parentNode;checkSet[i]=parent.nodeName.toLowerCase()===part?parent:false}}}else{for(;i<l;i++){elem=checkSet[i];if(elem){checkSet[i]=isPartStr?elem.parentNode:elem.parentNode===part}}if(isPartStr){Sizzle.filter(part,checkSet,true)}}},"":function(checkSet,part,isXML){var nodeCheck,doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!rNonWord.test(part)){part=part.toLowerCase();nodeCheck=part;checkFn=dirNodeCheck}checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML)},"~":function(checkSet,part,isXML){var nodeCheck,doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!rNonWord.test(part)){part=part.toLowerCase();nodeCheck=part;checkFn=dirNodeCheck}checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML)}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m&&m.parentNode?[m]:[]}},NAME:function(match,context){if(typeof context.getElementsByName!=="undefined"){var ret=[],results=context.getElementsByName(match[1]);for(var i=0,l=results.length;i<l;i++){if(results[i].getAttribute("name")===match[1]){ret.push(results[i])}}return ret.length===0?null:ret}},TAG:function(match,context){if(typeof context.getElementsByTagName!=="undefined"){return context.getElementsByTagName(match[1])}}},preFilter:{CLASS:function(match,curLoop,inplace,result,not,isXML){match=" "+match[1].replace(rBackslash,"")+" ";if(isXML){return match}for(var i=0,elem;(elem=curLoop[i])!=null;i++){if(elem){if(not^(elem.className&&(" "+elem.className+" ").replace(/[\t\n\r]/g," ").indexOf(match)>=0)){if(!inplace){result.push(elem)}}else if(inplace){curLoop[i]=false}}}return false},ID:function(match){return match[1].replace(rBackslash,"")},TAG:function(match,curLoop){return match[1].replace(rBackslash,"").toLowerCase()},CHILD:function(match){if(match[1]==="nth"){if(!match[2]){Sizzle.error(match[0])}match[2]=match[2].replace(/^\+|\s*/g,"");var test=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(match[2]==="even"&&"2n"||match[2]==="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);match[2]=test[1]+(test[2]||1)-0;match[3]=test[3]-0}else if(match[2]){Sizzle.error(match[0])}match[0]=done++;return match},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1]=match[1].replace(rBackslash,"");if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name]}match[4]=(match[4]||match[5]||"").replace(rBackslash,"");if(match[2]==="~="){match[4]=" "+match[4]+" "}return match},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if((chunker.exec(match[3])||"").length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop)}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);if(!inplace){result.push.apply(result,ret)}return false}}else if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true}return match},POS:function(match){match.unshift(true);return match}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden"},disabled:function(elem){return elem.disabled===true},checked:function(elem){return elem.checked===true},selected:function(elem){if(elem.parentNode){elem.parentNode.selectedIndex}return elem.selected===true},parent:function(elem){return!!elem.firstChild},empty:function(elem){return!elem.firstChild},has:function(elem,i,match){return!!Sizzle(match[3],elem).length},header:function(elem){return/h\d/i.test(elem.nodeName)},text:function(elem){var attr=elem.getAttribute("type"),type=elem.type;return elem.nodeName.toLowerCase()==="input"&&"text"===type&&(attr===type||attr===null)},radio:function(elem){return elem.nodeName.toLowerCase()==="input"&&"radio"===elem.type},checkbox:function(elem){return elem.nodeName.toLowerCase()==="input"&&"checkbox"===elem.type},file:function(elem){return elem.nodeName.toLowerCase()==="input"&&"file"===elem.type},password:function(elem){return elem.nodeName.toLowerCase()==="input"&&"password"===elem.type},submit:function(elem){var name=elem.nodeName.toLowerCase();return(name==="input"||name==="button")&&"submit"===elem.type},image:function(elem){return elem.nodeName.toLowerCase()==="input"&&"image"===elem.type},reset:function(elem){return elem.nodeName.toLowerCase()==="input"&&"reset"===elem.type},button:function(elem){var name=elem.nodeName.toLowerCase();return name==="input"&&"button"===elem.type||name==="button"},input:function(elem){return/input|select|textarea|button/i.test(elem.nodeName)},focus:function(elem){return elem===elem.ownerDocument.activeElement}},setFilters:{first:function(elem,i){return i===0},last:function(elem,i,match,array){return i===array.length-1},even:function(elem,i){return i%2===0},odd:function(elem,i){return i%2===1},lt:function(elem,i,match){return i<match[3]-0},gt:function(elem,i,match){return i>match[3]-0},nth:function(elem,i,match){return match[3]-0===i},eq:function(elem,i,match){return match[3]-0===i}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];if(filter){return filter(elem,i,match,array)}else if(name==="contains"){
return(elem.textContent||elem.innerText||Sizzle.getText([elem])||"").indexOf(match[3])>=0}else if(name==="not"){var not=match[3];for(var j=0,l=not.length;j<l;j++){if(not[j]===elem){return false}}return true}else{Sizzle.error(name)}},CHILD:function(elem,match){var type=match[1],node=elem;switch(type){case"only":case"first":while(node=node.previousSibling){if(node.nodeType===1){return false}}if(type==="first"){return true}node=elem;case"last":while(node=node.nextSibling){if(node.nodeType===1){return false}}return true;case"nth":var first=match[2],last=match[3];if(first===1&&last===0){return true}var doneName=match[0],parent=elem.parentNode;if(parent&&(parent.sizcache!==doneName||!elem.nodeIndex)){var count=0;for(node=parent.firstChild;node;node=node.nextSibling){if(node.nodeType===1){node.nodeIndex=++count}}parent.sizcache=doneName}var diff=elem.nodeIndex-last;if(first===0){return diff===0}else{return diff%first===0&&diff/first>=0}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match},TAG:function(elem,match){return match==="*"&&elem.nodeType===1||elem.nodeName.toLowerCase()===match},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1},ATTR:function(elem,match){var name=match[1],result=Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];return result==null?type==="!=":type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!==check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];if(filter){return filter(elem,i,match,array)}}}};var origPOS=Expr.match.POS,fescape=function(all,num){return"\\"+(num-0+1)};for(var type in Expr.match){Expr.match[type]=new RegExp(Expr.match[type].source+/(?![^\[]*\])(?![^\(]*\))/.source);Expr.leftMatch[type]=new RegExp(/(^(?:.|\r|\n)*?)/.source+Expr.match[type].source.replace(/\\(\d+)/g,fescape))}var makeArray=function(array,results){array=Array.prototype.slice.call(array,0);if(results){results.push.apply(results,array);return results}return array};try{Array.prototype.slice.call(document.documentElement.childNodes,0)[0].nodeType}catch(e){makeArray=function(array,results){var i=0,ret=results||[];if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array)}else{if(typeof array.length==="number"){for(var l=array.length;i<l;i++){ret.push(array[i])}}else{for(;array[i];i++){ret.push(array[i])}}}return ret}}var sortOrder,siblingCheck;if(document.documentElement.compareDocumentPosition){sortOrder=function(a,b){if(a===b){hasDuplicate=true;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition){return a.compareDocumentPosition?-1:1}return a.compareDocumentPosition(b)&4?-1:1}}else{sortOrder=function(a,b){var al,bl,ap=[],bp=[],aup=a.parentNode,bup=b.parentNode,cur=aup;if(a===b){hasDuplicate=true;return 0}else if(aup===bup){return siblingCheck(a,b)}else if(!aup){return-1}else if(!bup){return 1}while(cur){ap.unshift(cur);cur=cur.parentNode}cur=bup;while(cur){bp.unshift(cur);cur=cur.parentNode}al=ap.length;bl=bp.length;for(var i=0;i<al&&i<bl;i++){if(ap[i]!==bp[i]){return siblingCheck(ap[i],bp[i])}}return i===al?siblingCheck(a,bp[i],-1):siblingCheck(ap[i],b,1)};siblingCheck=function(a,b,ret){if(a===b){return ret}var cur=a.nextSibling;while(cur){if(cur===b){return-1}cur=cur.nextSibling}return 1}}Sizzle.getText=function(elems){var ret="",elem;for(var i=0;elems[i];i++){elem=elems[i];if(elem.nodeType===3||elem.nodeType===4){ret+=elem.nodeValue}else if(elem.nodeType!==8){ret+=Sizzle.getText(elem.childNodes)}}return ret};(function(){var form=document.createElement("div"),id="script"+(new Date).getTime(),root=document.documentElement;form.innerHTML="<a name='"+id+"'/>";root.insertBefore(form,root.firstChild);if(document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[]}};Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return elem.nodeType===1&&node&&node.nodeValue===match}}root.removeChild(form);root=form=null})();(function(){var div=document.createElement("div");div.appendChild(document.createComment(""));if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);if(match[1]==="*"){var tmp=[];for(var i=0;results[i];i++){if(results[i].nodeType===1){tmp.push(results[i])}}results=tmp}return results}}div.innerHTML="<a href='#'></a>";if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2)}}div=null})();if(document.querySelectorAll){(function(){var oldSizzle=Sizzle,div=document.createElement("div"),id="__sizzle__";div.innerHTML="<p class='TEST'></p>";if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return}Sizzle=function(query,context,extra,seed){context=context||document;if(!seed&&!Sizzle.isXML(context)){var match=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(query);if(match&&(context.nodeType===1||context.nodeType===9)){if(match[1]){return makeArray(context.getElementsByTagName(query),extra)}else if(match[2]&&Expr.find.CLASS&&context.getElementsByClassName){return makeArray(context.getElementsByClassName(match[2]),extra)}}if(context.nodeType===9){if(query==="body"&&context.body){return makeArray([context.body],extra)}else if(match&&match[3]){var elem=context.getElementById(match[3]);if(elem&&elem.parentNode){if(elem.id===match[3]){return makeArray([elem],extra)}}else{return makeArray([],extra)}}try{return makeArray(context.querySelectorAll(query),extra)}catch(qsaError){}}else if(context.nodeType===1&&context.nodeName.toLowerCase()!=="object"){var oldContext=context,old=context.getAttribute("id"),nid=old||id,hasParent=context.parentNode,relativeHierarchySelector=/^\s*[+~]/.test(query);if(!old){context.setAttribute("id",nid)}else{nid=nid.replace(/'/g,"\\$&")}if(relativeHierarchySelector&&hasParent){context=context.parentNode}try{if(!relativeHierarchySelector||hasParent){return makeArray(context.querySelectorAll("[id='"+nid+"'] "+query),extra)}}catch(pseudoError){}finally{if(!old){oldContext.removeAttribute("id")}}}}return oldSizzle(query,context,extra,seed)};for(var prop in oldSizzle){Sizzle[prop]=oldSizzle[prop]}div=null})()}(function(){var html=document.documentElement,matches=html.matchesSelector||html.mozMatchesSelector||html.webkitMatchesSelector||html.msMatchesSelector;if(matches){var disconnectedMatch=!matches.call(document.createElement("div"),"div"),pseudoWorks=false;try{matches.call(document.documentElement,"[test!='']:sizzle")}catch(pseudoError){pseudoWorks=true}Sizzle.matchesSelector=function(node,expr){expr=expr.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!Sizzle.isXML(node)){try{if(pseudoWorks||!Expr.match.PSEUDO.test(expr)&&!/!=/.test(expr)){var ret=matches.call(node,expr);if(ret||!disconnectedMatch||node.document&&node.document.nodeType!==11){return ret}}}catch(e){}}return Sizzle(expr,null,null,[node]).length>0}}})();(function(){var div=document.createElement("div");div.innerHTML="<div class='test e'></div><div class='test'></div>";if(!div.getElementsByClassName||div.getElementsByClassName("e").length===0){return}div.lastChild.className="e";if(div.getElementsByClassName("e").length===1){return}Expr.order.splice(1,0,"CLASS");Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1])}};div=null})();function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){var match=false;elem=elem[dir];while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break}if(elem.nodeType===1&&!isXML){elem.sizcache=doneName;elem.sizset=i}if(elem.nodeName.toLowerCase()===cur){match=elem;break}elem=elem[dir]}checkSet[i]=match}}}function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){var match=false;elem=elem[dir];while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break}if(elem.nodeType===1){if(!isXML){elem.sizcache=doneName;elem.sizset=i}if(typeof cur!=="string"){if(elem===cur){match=true;break}}else if(Sizzle.filter(cur,[elem]).length>0){match=elem;break}}elem=elem[dir]}checkSet[i]=match}}}if(document.documentElement.contains){Sizzle.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):true)}}else if(document.documentElement.compareDocumentPosition){Sizzle.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}}else{Sizzle.contains=function(){return false}}Sizzle.isXML=function(elem){var documentElement=(elem?elem.ownerDocument||elem:0).documentElement;return documentElement?documentElement.nodeName!=="HTML":false};var posProcess=function(selector,context){var match,tmpSet=[],later="",root=context.nodeType?[context]:context;while(match=Expr.match.PSEUDO.exec(selector)){later+=match[0];selector=selector.replace(Expr.match.PSEUDO,"")}selector=Expr.relative[selector]?selector+"*":selector;for(var i=0,l=root.length;i<l;i++){Sizzle(selector,root[i],tmpSet)}return Sizzle.filter(later,tmpSet)};jQuery.find=Sizzle;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.filters;jQuery.unique=Sizzle.uniqueSort;jQuery.text=Sizzle.getText;jQuery.isXMLDoc=Sizzle.isXML;jQuery.contains=Sizzle.contains})();var runtil=/Until$/,rparentsprev=/^(?:parents|prevUntil|prevAll)/,rmultiselector=/,/,isSimple=/^.[^:#\[\.,]*$/,slice=Array.prototype.slice,POS=jQuery.expr.match.POS,guaranteedUnique={children:true,contents:true,next:true,prev:true};jQuery.fn.extend({find:function(selector){var self=this,i,l;if(typeof selector!=="string"){return jQuery(selector).filter(function(){for(i=0,l=self.length;i<l;i++){if(jQuery.contains(self[i],this)){return true}}})}var ret=this.pushStack("","find",selector),length,n,r;for(i=0,l=this.length;i<l;i++){length=ret.length;jQuery.find(selector,this[i],ret);if(i>0){for(n=length;n<ret.length;n++){for(r=0;r<length;r++){if(ret[r]===ret[n]){ret.splice(n--,1);break}}}}}return ret},has:function(target){var targets=jQuery(target);return this.filter(function(){for(var i=0,l=targets.length;i<l;i++){if(jQuery.contains(this,targets[i])){return true}}})},not:function(selector){return this.pushStack(winnow(this,selector,false),"not",selector)},filter:function(selector){return this.pushStack(winnow(this,selector,true),"filter",selector)},is:function(selector){return!!selector&&(typeof selector==="string"?jQuery.filter(selector,this).length>0:this.filter(selector).length>0)},closest:function(selectors,context){var ret=[],i,l,cur=this[0];if(jQuery.isArray(selectors)){var match,selector,matches={},level=1;if(cur&&selectors.length){for(i=0,l=selectors.length;i<l;i++){selector=selectors[i];if(!matches[selector]){matches[selector]=POS.test(selector)?jQuery(selector,context||this.context):selector}}while(cur&&cur.ownerDocument&&cur!==context){for(selector in matches){match=matches[selector];if(match.jquery?match.index(cur)>-1:jQuery(cur).is(match)){ret.push({selector:selector,elem:cur,level:level})}}cur=cur.parentNode;level++}}return ret}var pos=POS.test(selectors)||typeof selectors!=="string"?jQuery(selectors,context||this.context):0;for(i=0,l=this.length;i<l;i++){cur=this[i];while(cur){if(pos?pos.index(cur)>-1:jQuery.find.matchesSelector(cur,selectors)){ret.push(cur);break}else{cur=cur.parentNode;if(!cur||!cur.ownerDocument||cur===context||cur.nodeType===11){break}}}}ret=ret.length>1?jQuery.unique(ret):ret;return this.pushStack(ret,"closest",selectors)},index:function(elem){if(!elem||typeof elem==="string"){return jQuery.inArray(this[0],elem?jQuery(elem):this.parent().children())}return jQuery.inArray(elem.jquery?elem[0]:elem,this)},add:function(selector,context){var set=typeof selector==="string"?jQuery(selector,context):jQuery.makeArray(selector&&selector.nodeType?[selector]:selector),all=jQuery.merge(this.get(),set);return this.pushStack(isDisconnected(set[0])||isDisconnected(all[0])?all:jQuery.unique(all))},andSelf:function(){return this.add(this.prevObject)}});function isDisconnected(node){return!node||!node.parentNode||node.parentNode.nodeType===11}jQuery.each({parent:function(elem){var parent=elem.parentNode;return parent&&parent.nodeType!==11?parent:null},parents:function(elem){return jQuery.dir(elem,"parentNode")},parentsUntil:function(elem,i,until){return jQuery.dir(elem,"parentNode",until)},next:function(elem){return jQuery.nth(elem,2,"nextSibling")},prev:function(elem){return jQuery.nth(elem,2,"previousSibling")},nextAll:function(elem){return jQuery.dir(elem,"nextSibling")},prevAll:function(elem){return jQuery.dir(elem,"previousSibling")},nextUntil:function(elem,i,until){return jQuery.dir(elem,"nextSibling",until)},prevUntil:function(elem,i,until){return jQuery.dir(elem,"previousSibling",until)},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem)},children:function(elem){return jQuery.sibling(elem.firstChild)},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes)}},function(name,fn){jQuery.fn[name]=function(until,selector){var ret=jQuery.map(this,fn,until),args=slice.call(arguments);if(!runtil.test(name)){selector=until}if(selector&&typeof selector==="string"){ret=jQuery.filter(selector,ret)}ret=this.length>1&&!guaranteedUnique[name]?jQuery.unique(ret):ret;if((this.length>1||rmultiselector.test(selector))&&rparentsprev.test(name)){ret=ret.reverse()}return this.pushStack(ret,name,args.join(","))}});jQuery.extend({filter:function(expr,elems,not){if(not){expr=":not("+expr+")"}return elems.length===1?jQuery.find.matchesSelector(elems[0],expr)?[elems[0]]:[]:jQuery.find.matches(expr,elems)},dir:function(elem,dir,until){var matched=[],cur=elem[dir];while(cur&&cur.nodeType!==9&&(until===undefined||cur.nodeType!==1||!jQuery(cur).is(until))){if(cur.nodeType===1){matched.push(cur)}cur=cur[dir]}return matched},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir]){if(cur.nodeType===1&&++num===result){break}}return cur},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType===1&&n!==elem){r.push(n)}}return r}});function winnow(elements,qualifier,keep){qualifier=qualifier||0;if(jQuery.isFunction(qualifier)){return jQuery.grep(elements,function(elem,i){var retVal=!!qualifier.call(elem,i,elem);return retVal===keep})}else if(qualifier.nodeType){return jQuery.grep(elements,function(elem,i){return elem===qualifier===keep})}else if(typeof qualifier==="string"){var filtered=jQuery.grep(elements,function(elem){return elem.nodeType===1});if(isSimple.test(qualifier)){return jQuery.filter(qualifier,filtered,!keep)}else{qualifier=jQuery.filter(qualifier,filtered)}}return jQuery.grep(elements,function(elem,i){return jQuery.inArray(elem,qualifier)>=0===keep})}var rinlinejQuery=/ jQuery\d+="(?:\d+|null)"/g,rleadingWhitespace=/^\s+/,rxhtmlTag=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,rtagName=/<([\w:]+)/,rtbody=/<tbody/i,rhtml=/<|&#?\w+;/,rnocache=/<(?:script|object|embed|option|style)/i,rchecked=/checked\s*(?:[^=]|=\s*.checked.)/i,rscriptType=/\/(java|ecma)script/i,wrapMap={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};wrapMap.optgroup=wrapMap.option;wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead;wrapMap.th=wrapMap.td;if(!jQuery.support.htmlSerialize){wrapMap._default=[1,"div<div>","</div>"]}jQuery.fn.extend({text:function(text){if(jQuery.isFunction(text)){return this.each(function(i){var self=jQuery(this);self.text(text.call(this,i,self.text()))})}if(typeof text!=="object"&&text!==undefined){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text))}return jQuery.text(this)},wrapAll:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapAll(html.call(this,i))})}if(this[0]){var wrap=jQuery(html,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){wrap.insertBefore(this[0])}wrap.map(function(){var elem=this;while(elem.firstChild&&elem.firstChild.nodeType===1){elem=elem.firstChild}return elem}).append(this)}return this},wrapInner:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapInner(html.call(this,i))})}return this.each(function(){var self=jQuery(this),contents=self.contents();if(contents.length){contents.wrapAll(html)}else{self.append(html)}})},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html)})},unwrap:function(){return this.parent().each(function(){if(!jQuery.nodeName(this,"body")){jQuery(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1){this.appendChild(elem)}})},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1){this.insertBefore(elem,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this)})}else if(arguments.length){var set=jQuery(arguments[0]);set.push.apply(set,this.toArray());return this.pushStack(set,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling)})}else if(arguments.length){var set=this.pushStack(this,"after",arguments);set.push.apply(set,jQuery(arguments[0]).toArray());return set}},remove:function(selector,keepData){for(var i=0,elem;(elem=this[i])!=null;i++){if(!selector||jQuery.filter(selector,[elem]).length){if(!keepData&&elem.nodeType===1){jQuery.cleanData(elem.getElementsByTagName("*"));jQuery.cleanData([elem])}if(elem.parentNode){elem.parentNode.removeChild(elem)}}}return this},empty:function(){for(var i=0,elem;(elem=this[i])!=null;i++){if(elem.nodeType===1){jQuery.cleanData(elem.getElementsByTagName("*"))}while(elem.firstChild){elem.removeChild(elem.firstChild)}}return this},clone:function(dataAndEvents,deepDataAndEvents){dataAndEvents=dataAndEvents==null?false:dataAndEvents;deepDataAndEvents=deepDataAndEvents==null?dataAndEvents:deepDataAndEvents;return this.map(function(){return jQuery.clone(this,dataAndEvents,deepDataAndEvents)})},html:function(value){if(value===undefined){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(rinlinejQuery,""):null}else if(typeof value==="string"&&!rnocache.test(value)&&(jQuery.support.leadingWhitespace||!rleadingWhitespace.test(value))&&!wrapMap[(rtagName.exec(value)||["",""])[1].toLowerCase()]){value=value.replace(rxhtmlTag,"<$1></$2>");try{for(var i=0,l=this.length;i<l;i++){if(this[i].nodeType===1){jQuery.cleanData(this[i].getElementsByTagName("*"));this[i].innerHTML=value}}}catch(e){this.empty().append(value)}}else if(jQuery.isFunction(value)){this.each(function(i){var self=jQuery(this);self.html(value.call(this,i,self.html()))})}else{this.empty().append(value)}return this},replaceWith:function(value){if(this[0]&&this[0].parentNode){if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this),old=self.html();self.replaceWith(value.call(this,i,old))})}if(typeof value!=="string"){value=jQuery(value).detach()}return this.each(function(){var next=this.nextSibling,parent=this.parentNode;jQuery(this).remove();if(next){jQuery(next).before(value)}else{jQuery(parent).append(value)}})}else{return this.length?this.pushStack(jQuery(jQuery.isFunction(value)?value():value),"replaceWith",value):this}},detach:function(selector){return this.remove(selector,true)},domManip:function(args,table,callback){var results,first,fragment,parent,value=args[0],scripts=[];if(!jQuery.support.checkClone&&arguments.length===3&&typeof value==="string"&&rchecked.test(value)){return this.each(function(){jQuery(this).domManip(args,table,callback,true)})}if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);args[0]=value.call(this,i,table?self.html():undefined);self.domManip(args,table,callback)})}if(this[0]){parent=value&&value.parentNode;if(jQuery.support.parentNode&&parent&&parent.nodeType===11&&parent.childNodes.length===this.length){results={fragment:parent}}else{results=jQuery.buildFragment(args,this,scripts)}fragment=results.fragment;if(fragment.childNodes.length===1){first=fragment=fragment.firstChild}else{first=fragment.firstChild}if(first){table=table&&jQuery.nodeName(first,"tr");for(var i=0,l=this.length,lastIndex=l-1;i<l;i++){callback.call(table?root(this[i],first):this[i],results.cacheable||l>1&&i<lastIndex?jQuery.clone(fragment,true,true):fragment)}}if(scripts.length){jQuery.each(scripts,evalScript)}}return this}});function root(elem,cur){return jQuery.nodeName(elem,"table")?elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody")):elem}function cloneCopyEvent(src,dest){if(dest.nodeType!==1||!jQuery.hasData(src)){return}var internalKey=jQuery.expando,oldData=jQuery.data(src),curData=jQuery.data(dest,oldData);if(oldData=oldData[internalKey]){var events=oldData.events;curData=curData[internalKey]=jQuery.extend({},oldData);if(events){delete curData.handle;curData.events={};for(var type in events){for(var i=0,l=events[type].length;i<l;i++){jQuery.event.add(dest,type+(events[type][i].namespace?".":"")+events[type][i].namespace,events[type][i],events[type][i].data)}}}}}function cloneFixAttributes(src,dest){var nodeName;if(dest.nodeType!==1){return}if(dest.clearAttributes){dest.clearAttributes()}if(dest.mergeAttributes){dest.mergeAttributes(src)}nodeName=dest.nodeName.toLowerCase();if(nodeName==="object"){dest.outerHTML=src.outerHTML}else if(nodeName==="input"&&(src.type==="checkbox"||src.type==="radio")){if(src.checked){dest.defaultChecked=dest.checked=src.checked}if(dest.value!==src.value){dest.value=src.value}}else if(nodeName==="option"){dest.selected=src.defaultSelected}else if(nodeName==="input"||nodeName==="textarea"){dest.defaultValue=src.defaultValue}dest.removeAttribute(jQuery.expando)}jQuery.buildFragment=function(args,nodes,scripts){var fragment,cacheable,cacheresults,doc=nodes&&nodes[0]?nodes[0].ownerDocument||nodes[0]:document;if(args.length===1&&typeof args[0]==="string"&&args[0].length<512&&doc===document&&args[0].charAt(0)==="<"&&!rnocache.test(args[0])&&(jQuery.support.checkClone||!rchecked.test(args[0]))){cacheable=true;cacheresults=jQuery.fragments[args[0]];if(cacheresults&&cacheresults!==1){fragment=cacheresults}}if(!fragment){fragment=doc.createDocumentFragment();jQuery.clean(args,doc,fragment,scripts)}if(cacheable){jQuery.fragments[args[0]]=cacheresults?fragment:1}return{fragment:fragment,cacheable:cacheable}};jQuery.fragments={};jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var ret=[],insert=jQuery(selector),parent=this.length===1&&this[0].parentNode;if(parent&&parent.nodeType===11&&parent.childNodes.length===1&&insert.length===1){insert[original](this[0]);return this}else{for(var i=0,l=insert.length;i<l;i++){var elems=(i>0?this.clone(true):this).get();jQuery(insert[i])[original](elems);ret=ret.concat(elems)}return this.pushStack(ret,name,insert.selector)}}});function getAll(elem){if("getElementsByTagName"in elem){return elem.getElementsByTagName("*")}else if("querySelectorAll"in elem){return elem.querySelectorAll("*")}else{return[]}}function fixDefaultChecked(elem){if(elem.type==="checkbox"||elem.type==="radio"){elem.defaultChecked=elem.checked}}function findInputs(elem){if(jQuery.nodeName(elem,"input")){fixDefaultChecked(elem)}else if(elem.getElementsByTagName){jQuery.grep(elem.getElementsByTagName("input"),fixDefaultChecked)}}jQuery.extend({clone:function(elem,dataAndEvents,deepDataAndEvents){var clone=elem.cloneNode(true),srcElements,destElements,i;if((!jQuery.support.noCloneEvent||!jQuery.support.noCloneChecked)&&(elem.nodeType===1||elem.nodeType===11)&&!jQuery.isXMLDoc(elem)){cloneFixAttributes(elem,clone);srcElements=getAll(elem);destElements=getAll(clone);for(i=0;srcElements[i];++i){cloneFixAttributes(srcElements[i],destElements[i])}}if(dataAndEvents){cloneCopyEvent(elem,clone);if(deepDataAndEvents){srcElements=getAll(elem);destElements=getAll(clone);for(i=0;srcElements[i];++i){cloneCopyEvent(srcElements[i],destElements[i])}}}return clone},clean:function(elems,context,fragment,scripts){var checkScriptType;context=context||document;if(typeof context.createElement==="undefined"){context=context.ownerDocument||context[0]&&context[0].ownerDocument||document}var ret=[];for(var i=0,elem;(elem=elems[i])!=null;i++){if(typeof elem==="number"){elem+=""}if(!elem){continue}if(typeof elem==="string"){if(!rhtml.test(elem)){elem=context.createTextNode(elem)}else{elem=elem.replace(rxhtmlTag,"<$1></$2>");var tag=(rtagName.exec(elem)||["",""])[1].toLowerCase(),wrap=wrapMap[tag]||wrapMap._default,depth=wrap[0],div=context.createElement("div");div.innerHTML=wrap[1]+elem+wrap[2];while(depth--){div=div.lastChild}if(!jQuery.support.tbody){var hasBody=rtbody.test(elem),tbody=tag==="table"&&!hasBody?div.firstChild&&div.firstChild.childNodes:wrap[1]==="<table>"&&!hasBody?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j){if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length){tbody[j].parentNode.removeChild(tbody[j])}}}if(!jQuery.support.leadingWhitespace&&rleadingWhitespace.test(elem)){div.insertBefore(context.createTextNode(rleadingWhitespace.exec(elem)[0]),div.firstChild)}elem=div.childNodes}}var len;if(!jQuery.support.appendChecked){if(elem[0]&&typeof(len=elem.length)==="number"){for(i=0;i<len;i++){findInputs(elem[i])}}else{findInputs(elem)}}if(elem.nodeType){ret.push(elem)}else{ret=jQuery.merge(ret,elem)}}if(fragment){checkScriptType=function(elem){return!elem.type||rscriptType.test(elem.type)};for(i=0;ret[i];i++){if(scripts&&jQuery.nodeName(ret[i],"script")&&(!ret[i].type||ret[i].type.toLowerCase()==="text/javascript")){scripts.push(ret[i].parentNode?ret[i].parentNode.removeChild(ret[i]):ret[i])}else{if(ret[i].nodeType===1){var jsTags=jQuery.grep(ret[i].getElementsByTagName("script"),checkScriptType);ret.splice.apply(ret,[i+1,0].concat(jsTags))}fragment.appendChild(ret[i])}}}return ret},cleanData:function(elems){var data,id,cache=jQuery.cache,internalKey=jQuery.expando,special=jQuery.event.special,deleteExpando=jQuery.support.deleteExpando;for(var i=0,elem;(elem=elems[i])!=null;i++){if(elem.nodeName&&jQuery.noData[elem.nodeName.toLowerCase()]){continue}id=elem[jQuery.expando];if(id){data=cache[id]&&cache[id][internalKey];if(data&&data.events){for(var type in data.events){if(special[type]){jQuery.event.remove(elem,type)}else{jQuery.removeEvent(elem,type,data.handle)}}if(data.handle){data.handle.elem=null}}if(deleteExpando){delete elem[jQuery.expando]}else if(elem.removeAttribute){elem.removeAttribute(jQuery.expando)}delete cache[id]}}}});function evalScript(i,elem){if(elem.src){jQuery.ajax({url:elem.src,async:false,dataType:"script"})}else{jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"")}if(elem.parentNode){elem.parentNode.removeChild(elem)}}var ralpha=/alpha\([^)]*\)/i,ropacity=/opacity=([^)]*)/,rdashAlpha=/-([a-z])/gi,rupper=/([A-Z]|^ms)/g,rnumpx=/^-?\d+(?:px)?$/i,rnum=/^-?\d/,rrelNum=/^[+\-]=/,rrelNumFilter=/[^+\-\.\de]+/g,cssShow={position:"absolute",visibility:"hidden",display:"block"},cssWidth=["Left","Right"],cssHeight=["Top","Bottom"],curCSS,getComputedStyle,currentStyle,fcamelCase=function(all,letter){return letter.toUpperCase()};jQuery.fn.css=function(name,value){if(arguments.length===2&&value===undefined){return this}return jQuery.access(this,name,value,true,function(elem,name,value){return value!==undefined?jQuery.style(elem,name,value):jQuery.css(elem,name)})};jQuery.extend({cssHooks:{opacity:{get:function(elem,computed){if(computed){var ret=curCSS(elem,"opacity","opacity");return ret===""?"1":ret}else{return elem.style.opacity}}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,zoom:true,lineHeight:true,widows:true,orphans:true},cssProps:{"float":jQuery.support.cssFloat?"cssFloat":"styleFloat"},style:function(elem,name,value,extra){if(!elem||elem.nodeType===3||elem.nodeType===8||!elem.style){return}var ret,type,origName=jQuery.camelCase(name),style=elem.style,hooks=jQuery.cssHooks[origName];name=jQuery.cssProps[origName]||origName;if(value!==undefined){type=typeof value;if(type==="number"&&isNaN(value)||value==null){return}if(type==="string"&&rrelNum.test(value)){value=+value.replace(rrelNumFilter,"")+parseFloat(jQuery.css(elem,name))}if(type==="number"&&!jQuery.cssNumber[origName]){value+="px"}if(!hooks||!("set"in hooks)||(value=hooks.set(elem,value))!==undefined){try{style[name]=value}catch(e){}}}else{if(hooks&&"get"in hooks&&(ret=hooks.get(elem,false,extra))!==undefined){return ret}return style[name]}},css:function(elem,name,extra){var ret,hooks;name=jQuery.camelCase(name);hooks=jQuery.cssHooks[name];name=jQuery.cssProps[name]||name;if(name==="cssFloat"){name="float"}if(hooks&&"get"in hooks&&(ret=hooks.get(elem,true,extra))!==undefined){return ret}else if(curCSS){return curCSS(elem,name)}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name]}callback.call(elem);for(name in options){elem.style[name]=old[name]}},camelCase:function(string){return string.replace(rdashAlpha,fcamelCase)}});jQuery.curCSS=jQuery.css;jQuery.each(["height","width"],function(i,name){jQuery.cssHooks[name]={get:function(elem,computed,extra){var val;if(computed){if(elem.offsetWidth!==0){val=getWH(elem,name,extra)}else{jQuery.swap(elem,cssShow,function(){val=getWH(elem,name,extra)})}if(val<=0){val=curCSS(elem,name,name);if(val==="0px"&¤tStyle){val=currentStyle(elem,name,name)}if(val!=null){return val===""||val==="auto"?"0px":val}}if(val<0||val==null){val=elem.style[name];return val===""||val==="auto"?"0px":val}return typeof val==="string"?val:val+"px"}},set:function(elem,value){if(rnumpx.test(value)){value=parseFloat(value);if(value>=0){return value+"px"}}else{return value}}}});if(!jQuery.support.opacity){jQuery.cssHooks.opacity={get:function(elem,computed){return ropacity.test((computed&&elem.currentStyle?elem.currentStyle.filter:elem.style.filter)||"")?parseFloat(RegExp.$1)/100+"":computed?"1":""},set:function(elem,value){var style=elem.style,currentStyle=elem.currentStyle;style.zoom=1;var opacity=jQuery.isNaN(value)?"":"alpha(opacity="+value*100+")",filter=currentStyle&¤tStyle.filter||style.filter||"";style.filter=ralpha.test(filter)?filter.replace(ralpha,opacity):filter+" "+opacity}}}jQuery(function(){if(!jQuery.support.reliableMarginRight){jQuery.cssHooks.marginRight={get:function(elem,computed){var ret;jQuery.swap(elem,{display:"inline-block"},function(){if(computed){ret=curCSS(elem,"margin-right","marginRight")}else{ret=elem.style.marginRight}});return ret}}}});if(document.defaultView&&document.defaultView.getComputedStyle){getComputedStyle=function(elem,name){var ret,defaultView,computedStyle;name=name.replace(rupper,"-$1").toLowerCase();if(!(defaultView=elem.ownerDocument.defaultView)){
return undefined}if(computedStyle=defaultView.getComputedStyle(elem,null)){ret=computedStyle.getPropertyValue(name);if(ret===""&&!jQuery.contains(elem.ownerDocument.documentElement,elem)){ret=jQuery.style(elem,name)}}return ret}}if(document.documentElement.currentStyle){currentStyle=function(elem,name){var left,ret=elem.currentStyle&&elem.currentStyle[name],rsLeft=elem.runtimeStyle&&elem.runtimeStyle[name],style=elem.style;if(!rnumpx.test(ret)&&rnum.test(ret)){left=style.left;if(rsLeft){elem.runtimeStyle.left=elem.currentStyle.left}style.left=name==="fontSize"?"1em":ret||0;ret=style.pixelLeft+"px";style.left=left;if(rsLeft){elem.runtimeStyle.left=rsLeft}}return ret===""?"auto":ret}}curCSS=getComputedStyle||currentStyle;function getWH(elem,name,extra){var which=name==="width"?cssWidth:cssHeight,val=name==="width"?elem.offsetWidth:elem.offsetHeight;if(extra==="border"){return val}jQuery.each(which,function(){if(!extra){val-=parseFloat(jQuery.css(elem,"padding"+this))||0}if(extra==="margin"){val+=parseFloat(jQuery.css(elem,"margin"+this))||0}else{val-=parseFloat(jQuery.css(elem,"border"+this+"Width"))||0}});return val}if(jQuery.expr&&jQuery.expr.filters){jQuery.expr.filters.hidden=function(elem){var width=elem.offsetWidth,height=elem.offsetHeight;return width===0&&height===0||!jQuery.support.reliableHiddenOffsets&&(elem.style.display||jQuery.css(elem,"display"))==="none"};jQuery.expr.filters.visible=function(elem){return!jQuery.expr.filters.hidden(elem)}}var r20=/%20/g,rbracket=/\[\]$/,rCRLF=/\r?\n/g,rhash=/#.*$/,rheaders=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,rinput=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,rlocalProtocol=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,rnoContent=/^(?:GET|HEAD)$/,rprotocol=/^\/\//,rquery=/\?/,rscript=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,rselectTextarea=/^(?:select|textarea)/i,rspacesAjax=/\s+/,rts=/([?&])_=[^&]*/,rurl=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,_load=jQuery.fn.load,prefilters={},transports={},ajaxLocation,ajaxLocParts;try{ajaxLocation=location.href}catch(e){ajaxLocation=document.createElement("a");ajaxLocation.href="";ajaxLocation=ajaxLocation.href}ajaxLocParts=rurl.exec(ajaxLocation.toLowerCase())||[];function addToPrefiltersOrTransports(structure){return function(dataTypeExpression,func){if(typeof dataTypeExpression!=="string"){func=dataTypeExpression;dataTypeExpression="*"}if(jQuery.isFunction(func)){var dataTypes=dataTypeExpression.toLowerCase().split(rspacesAjax),i=0,length=dataTypes.length,dataType,list,placeBefore;for(;i<length;i++){dataType=dataTypes[i];placeBefore=/^\+/.test(dataType);if(placeBefore){dataType=dataType.substr(1)||"*"}list=structure[dataType]=structure[dataType]||[];list[placeBefore?"unshift":"push"](func)}}}}function inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR,dataType,inspected){dataType=dataType||options.dataTypes[0];inspected=inspected||{};inspected[dataType]=true;var list=structure[dataType],i=0,length=list?list.length:0,executeOnly=structure===prefilters,selection;for(;i<length&&(executeOnly||!selection);i++){selection=list[i](options,originalOptions,jqXHR);if(typeof selection==="string"){if(!executeOnly||inspected[selection]){selection=undefined}else{options.dataTypes.unshift(selection);selection=inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR,selection,inspected)}}}if((executeOnly||!selection)&&!inspected["*"]){selection=inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR,"*",inspected)}return selection}jQuery.fn.extend({load:function(url,params,callback){if(typeof url!=="string"&&_load){return _load.apply(this,arguments)}else if(!this.length){return this}var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off)}var type="GET";if(params){if(jQuery.isFunction(params)){callback=params;params=undefined}else if(typeof params==="object"){params=jQuery.param(params,jQuery.ajaxSettings.traditional);type="POST"}}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(jqXHR,status,responseText){responseText=jqXHR.responseText;if(jqXHR.isResolved()){jqXHR.done(function(r){responseText=r});self.html(selector?jQuery("<div>").append(responseText.replace(rscript,"")).find(selector):responseText)}if(callback){self.each(callback,[responseText,status,jqXHR])}}});return this},serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||rselectTextarea.test(this.nodeName)||rinput.test(this.type))}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val,i){return{name:elem.name,value:val.replace(rCRLF,"\r\n")}}):{name:elem.name,value:val.replace(rCRLF,"\r\n")}}).get()}});jQuery.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f)}});jQuery.each(["get","post"],function(i,method){jQuery[method]=function(url,data,callback,type){if(jQuery.isFunction(data)){type=type||callback;callback=data;data=undefined}return jQuery.ajax({type:method,url:url,data:data,success:callback,dataType:type})}});jQuery.extend({getScript:function(url,callback){return jQuery.get(url,undefined,callback,"script")},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json")},ajaxSetup:function(target,settings){if(!settings){settings=target;target=jQuery.extend(true,jQuery.ajaxSettings,settings)}else{jQuery.extend(true,target,jQuery.ajaxSettings,settings)}for(var field in{context:1,url:1}){if(field in settings){target[field]=settings[field]}else if(field in jQuery.ajaxSettings){target[field]=jQuery.ajaxSettings[field]}}return target},ajaxSettings:{url:ajaxLocation,isLocal:rlocalProtocol.test(ajaxLocParts[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":window.String,"text html":true,"text json":jQuery.parseJSON,"text xml":jQuery.parseXML}},ajaxPrefilter:addToPrefiltersOrTransports(prefilters),ajaxTransport:addToPrefiltersOrTransports(transports),ajax:function(url,options){if(typeof url==="object"){options=url;url=undefined}options=options||{};var s=jQuery.ajaxSetup({},options),callbackContext=s.context||s,globalEventContext=callbackContext!==s&&(callbackContext.nodeType||callbackContext instanceof jQuery)?jQuery(callbackContext):jQuery.event,deferred=jQuery.Deferred(),completeDeferred=jQuery._Deferred(),statusCode=s.statusCode||{},ifModifiedKey,requestHeaders={},requestHeadersNames={},responseHeadersString,responseHeaders,transport,timeoutTimer,parts,state=0,fireGlobals,i,jqXHR={readyState:0,setRequestHeader:function(name,value){if(!state){var lname=name.toLowerCase();name=requestHeadersNames[lname]=requestHeadersNames[lname]||name;requestHeaders[name]=value}return this},getAllResponseHeaders:function(){return state===2?responseHeadersString:null},getResponseHeader:function(key){var match;if(state===2){if(!responseHeaders){responseHeaders={};while(match=rheaders.exec(responseHeadersString)){responseHeaders[match[1].toLowerCase()]=match[2]}}match=responseHeaders[key.toLowerCase()]}return match===undefined?null:match},overrideMimeType:function(type){if(!state){s.mimeType=type}return this},abort:function(statusText){statusText=statusText||"abort";if(transport){transport.abort(statusText)}done(0,statusText);return this}};function done(status,statusText,responses,headers){if(state===2){return}state=2;if(timeoutTimer){clearTimeout(timeoutTimer)}transport=undefined;responseHeadersString=headers||"";jqXHR.readyState=status?4:0;var isSuccess,success,error,response=responses?ajaxHandleResponses(s,jqXHR,responses):undefined,lastModified,etag;if(status>=200&&status<300||status===304){if(s.ifModified){if(lastModified=jqXHR.getResponseHeader("Last-Modified")){jQuery.lastModified[ifModifiedKey]=lastModified}if(etag=jqXHR.getResponseHeader("Etag")){jQuery.etag[ifModifiedKey]=etag}}if(status===304){statusText="notmodified";isSuccess=true}else{try{success=ajaxConvert(s,response);statusText="success";isSuccess=true}catch(e){statusText="parsererror";error=e}}}else{error=statusText;if(!statusText||status){statusText="error";if(status<0){status=0}}}jqXHR.status=status;jqXHR.statusText=statusText;if(isSuccess){deferred.resolveWith(callbackContext,[success,statusText,jqXHR])}else{deferred.rejectWith(callbackContext,[jqXHR,statusText,error])}jqXHR.statusCode(statusCode);statusCode=undefined;if(fireGlobals){globalEventContext.trigger("ajax"+(isSuccess?"Success":"Error"),[jqXHR,s,isSuccess?success:error])}completeDeferred.resolveWith(callbackContext,[jqXHR,statusText]);if(fireGlobals){globalEventContext.trigger("ajaxComplete",[jqXHR,s]);if(!--jQuery.active){jQuery.event.trigger("ajaxStop")}}}deferred.promise(jqXHR);jqXHR.success=jqXHR.done;jqXHR.error=jqXHR.fail;jqXHR.complete=completeDeferred.done;jqXHR.statusCode=function(map){if(map){var tmp;if(state<2){for(tmp in map){statusCode[tmp]=[statusCode[tmp],map[tmp]]}}else{tmp=map[jqXHR.status];jqXHR.then(tmp,tmp)}}return this};s.url=((url||s.url)+"").replace(rhash,"").replace(rprotocol,ajaxLocParts[1]+"//");s.dataTypes=jQuery.trim(s.dataType||"*").toLowerCase().split(rspacesAjax);if(s.crossDomain==null){parts=rurl.exec(s.url.toLowerCase());s.crossDomain=!!(parts&&(parts[1]!=ajaxLocParts[1]||parts[2]!=ajaxLocParts[2]||(parts[3]||(parts[1]==="http:"?80:443))!=(ajaxLocParts[3]||(ajaxLocParts[1]==="http:"?80:443))))}if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data,s.traditional)}inspectPrefiltersOrTransports(prefilters,s,options,jqXHR);if(state===2){return false}fireGlobals=s.global;s.type=s.type.toUpperCase();s.hasContent=!rnoContent.test(s.type);if(fireGlobals&&jQuery.active++===0){jQuery.event.trigger("ajaxStart")}if(!s.hasContent){if(s.data){s.url+=(rquery.test(s.url)?"&":"?")+s.data}ifModifiedKey=s.url;if(s.cache===false){var ts=jQuery.now(),ret=s.url.replace(rts,"$1_="+ts);s.url=ret+(ret===s.url?(rquery.test(s.url)?"&":"?")+"_="+ts:"")}}if(s.data&&s.hasContent&&s.contentType!==false||options.contentType){jqXHR.setRequestHeader("Content-Type",s.contentType)}if(s.ifModified){ifModifiedKey=ifModifiedKey||s.url;if(jQuery.lastModified[ifModifiedKey]){jqXHR.setRequestHeader("If-Modified-Since",jQuery.lastModified[ifModifiedKey])}if(jQuery.etag[ifModifiedKey]){jqXHR.setRequestHeader("If-None-Match",jQuery.etag[ifModifiedKey])}}jqXHR.setRequestHeader("Accept",s.dataTypes[0]&&s.accepts[s.dataTypes[0]]?s.accepts[s.dataTypes[0]]+(s.dataTypes[0]!=="*"?", */*; q=0.01":""):s.accepts["*"]);for(i in s.headers){jqXHR.setRequestHeader(i,s.headers[i])}if(s.beforeSend&&(s.beforeSend.call(callbackContext,jqXHR,s)===false||state===2)){jqXHR.abort();return false}for(i in{success:1,error:1,complete:1}){jqXHR[i](s[i])}transport=inspectPrefiltersOrTransports(transports,s,options,jqXHR);if(!transport){done(-1,"No Transport")}else{jqXHR.readyState=1;if(fireGlobals){globalEventContext.trigger("ajaxSend",[jqXHR,s])}if(s.async&&s.timeout>0){timeoutTimer=setTimeout(function(){jqXHR.abort("timeout")},s.timeout)}try{state=1;transport.send(requestHeaders,done)}catch(e){if(status<2){done(-1,e)}else{jQuery.error(e)}}}return jqXHR},param:function(a,traditional){var s=[],add=function(key,value){value=jQuery.isFunction(value)?value():value;s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value)};if(traditional===undefined){traditional=jQuery.ajaxSettings.traditional}if(jQuery.isArray(a)||a.jquery&&!jQuery.isPlainObject(a)){jQuery.each(a,function(){add(this.name,this.value)})}else{for(var prefix in a){buildParams(prefix,a[prefix],traditional,add)}}return s.join("&").replace(r20,"+")}});function buildParams(prefix,obj,traditional,add){if(jQuery.isArray(obj)){jQuery.each(obj,function(i,v){if(traditional||rbracket.test(prefix)){add(prefix,v)}else{buildParams(prefix+"["+(typeof v==="object"||jQuery.isArray(v)?i:"")+"]",v,traditional,add)}})}else if(!traditional&&obj!=null&&typeof obj==="object"){for(var name in obj){buildParams(prefix+"["+name+"]",obj[name],traditional,add)}}else{add(prefix,obj)}}jQuery.extend({active:0,lastModified:{},etag:{}});function ajaxHandleResponses(s,jqXHR,responses){var contents=s.contents,dataTypes=s.dataTypes,responseFields=s.responseFields,ct,type,finalDataType,firstDataType;for(type in responseFields){if(type in responses){jqXHR[responseFields[type]]=responses[type]}}while(dataTypes[0]==="*"){dataTypes.shift();if(ct===undefined){ct=s.mimeType||jqXHR.getResponseHeader("content-type")}}if(ct){for(type in contents){if(contents[type]&&contents[type].test(ct)){dataTypes.unshift(type);break}}}if(dataTypes[0]in responses){finalDataType=dataTypes[0]}else{for(type in responses){if(!dataTypes[0]||s.converters[type+" "+dataTypes[0]]){finalDataType=type;break}if(!firstDataType){firstDataType=type}}finalDataType=finalDataType||firstDataType}if(finalDataType){if(finalDataType!==dataTypes[0]){dataTypes.unshift(finalDataType)}return responses[finalDataType]}}function ajaxConvert(s,response){if(s.dataFilter){response=s.dataFilter(response,s.dataType)}var dataTypes=s.dataTypes,converters={},i,key,length=dataTypes.length,tmp,current=dataTypes[0],prev,conversion,conv,conv1,conv2;for(i=1;i<length;i++){if(i===1){for(key in s.converters){if(typeof key==="string"){converters[key.toLowerCase()]=s.converters[key]}}}prev=current;current=dataTypes[i];if(current==="*"){current=prev}else if(prev!=="*"&&prev!==current){conversion=prev+" "+current;conv=converters[conversion]||converters["* "+current];if(!conv){conv2=undefined;for(conv1 in converters){tmp=conv1.split(" ");if(tmp[0]===prev||tmp[0]==="*"){conv2=converters[tmp[1]+" "+current];if(conv2){conv1=converters[conv1];if(conv1===true){conv=conv2}else if(conv2===true){conv=conv1}break}}}}if(!(conv||conv2)){jQuery.error("No conversion from "+conversion.replace(" "," to "))}if(conv!==true){response=conv?conv(response):conv2(conv1(response))}}}return response}var jsc=jQuery.now(),jsre=/(\=)\?(&|$)|\?\?/i;jQuery.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return jQuery.expando+"_"+jsc++}});jQuery.ajaxPrefilter("json jsonp",function(s,originalSettings,jqXHR){var inspectData=s.contentType==="application/x-www-form-urlencoded"&&typeof s.data==="string";if(s.dataTypes[0]==="jsonp"||s.jsonp!==false&&(jsre.test(s.url)||inspectData&&jsre.test(s.data))){var responseContainer,jsonpCallback=s.jsonpCallback=jQuery.isFunction(s.jsonpCallback)?s.jsonpCallback():s.jsonpCallback,previous=window[jsonpCallback],url=s.url,data=s.data,replace="$1"+jsonpCallback+"$2";if(s.jsonp!==false){url=url.replace(jsre,replace);if(s.url===url){if(inspectData){data=data.replace(jsre,replace)}if(s.data===data){url+=(/\?/.test(url)?"&":"?")+s.jsonp+"="+jsonpCallback}}}s.url=url;s.data=data;window[jsonpCallback]=function(response){responseContainer=[response]};jqXHR.always(function(){window[jsonpCallback]=previous;if(responseContainer&&jQuery.isFunction(previous)){window[jsonpCallback](responseContainer[0])}});s.converters["script json"]=function(){if(!responseContainer){jQuery.error(jsonpCallback+" was not called")}return responseContainer[0]};s.dataTypes[0]="json";return"script"}});jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(text){jQuery.globalEval(text);return text}}});jQuery.ajaxPrefilter("script",function(s){if(s.cache===undefined){s.cache=false}if(s.crossDomain){s.type="GET";s.global=false}});jQuery.ajaxTransport("script",function(s){if(s.crossDomain){var script,head=document.head||document.getElementsByTagName("head")[0]||document.documentElement;return{send:function(_,callback){script=document.createElement("script");script.async="async";if(s.scriptCharset){script.charset=s.scriptCharset}script.src=s.url;script.onload=script.onreadystatechange=function(_,isAbort){if(isAbort||!script.readyState||/loaded|complete/.test(script.readyState)){script.onload=script.onreadystatechange=null;if(head&&script.parentNode){head.removeChild(script)}script=undefined;if(!isAbort){callback(200,"success")}}};head.insertBefore(script,head.firstChild)},abort:function(){if(script){script.onload(0,1)}}}}});var xhrOnUnloadAbort=window.ActiveXObject?function(){for(var key in xhrCallbacks){xhrCallbacks[key](0,1)}}:false,xhrId=0,xhrCallbacks;function createStandardXHR(){try{return new window.XMLHttpRequest}catch(e){}}function createActiveXHR(){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}jQuery.ajaxSettings.xhr=window.ActiveXObject?function(){return!this.isLocal&&createStandardXHR()||createActiveXHR()}:createStandardXHR;(function(xhr){jQuery.extend(jQuery.support,{ajax:!!xhr,cors:!!xhr&&"withCredentials"in xhr})})(jQuery.ajaxSettings.xhr());if(jQuery.support.ajax){jQuery.ajaxTransport(function(s){if(!s.crossDomain||jQuery.support.cors){var callback;return{send:function(headers,complete){var xhr=s.xhr(),handle,i;if(s.username){xhr.open(s.type,s.url,s.async,s.username,s.password)}else{xhr.open(s.type,s.url,s.async)}if(s.xhrFields){for(i in s.xhrFields){xhr[i]=s.xhrFields[i]}}if(s.mimeType&&xhr.overrideMimeType){xhr.overrideMimeType(s.mimeType)}if(!s.crossDomain&&!headers["X-Requested-With"]){headers["X-Requested-With"]="XMLHttpRequest"}try{for(i in headers){xhr.setRequestHeader(i,headers[i])}}catch(_){}xhr.send(s.hasContent&&s.data||null);callback=function(_,isAbort){var status,statusText,responseHeaders,responses,xml;try{if(callback&&(isAbort||xhr.readyState===4)){callback=undefined;if(handle){xhr.onreadystatechange=jQuery.noop;if(xhrOnUnloadAbort){delete xhrCallbacks[handle]}}if(isAbort){if(xhr.readyState!==4){xhr.abort()}}else{status=xhr.status;responseHeaders=xhr.getAllResponseHeaders();responses={};xml=xhr.responseXML;if(xml&&xml.documentElement){responses.xml=xml}responses.text=xhr.responseText;try{statusText=xhr.statusText}catch(e){statusText=""}if(!status&&s.isLocal&&!s.crossDomain){status=responses.text?200:404}else if(status===1223){status=204}}}}catch(firefoxAccessException){if(!isAbort){complete(-1,firefoxAccessException)}}if(responses){complete(status,statusText,responses,responseHeaders)}};if(!s.async||xhr.readyState===4){callback()}else{handle=++xhrId;if(xhrOnUnloadAbort){if(!xhrCallbacks){xhrCallbacks={};jQuery(window).unload(xhrOnUnloadAbort)}xhrCallbacks[handle]=callback}xhr.onreadystatechange=callback}},abort:function(){if(callback){callback(0,1)}}}}})}var elemdisplay={},iframe,iframeDoc,rfxtypes=/^(?:toggle|show|hide)$/,rfxnum=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,timerId,fxAttrs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],fxNow,requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame;jQuery.fn.extend({show:function(speed,easing,callback){var elem,display;if(speed||speed===0){return this.animate(genFx("show",3),speed,easing,callback)}else{for(var i=0,j=this.length;i<j;i++){elem=this[i];if(elem.style){display=elem.style.display;if(!jQuery._data(elem,"olddisplay")&&display==="none"){display=elem.style.display=""}if(display===""&&jQuery.css(elem,"display")==="none"){jQuery._data(elem,"olddisplay",defaultDisplay(elem.nodeName))}}}for(i=0;i<j;i++){elem=this[i];if(elem.style){display=elem.style.display;if(display===""||display==="none"){elem.style.display=jQuery._data(elem,"olddisplay")||""}}}return this}},hide:function(speed,easing,callback){if(speed||speed===0){return this.animate(genFx("hide",3),speed,easing,callback)}else{for(var i=0,j=this.length;i<j;i++){if(this[i].style){var display=jQuery.css(this[i],"display");if(display!=="none"&&!jQuery._data(this[i],"olddisplay")){jQuery._data(this[i],"olddisplay",display)}}}for(i=0;i<j;i++){if(this[i].style){this[i].style.display="none"}}return this}},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2,callback){var bool=typeof fn==="boolean";if(jQuery.isFunction(fn)&&jQuery.isFunction(fn2)){this._toggle.apply(this,arguments)}else if(fn==null||bool){this.each(function(){var state=bool?fn:jQuery(this).is(":hidden");jQuery(this)[state?"show":"hide"]()})}else{this.animate(genFx("toggle",3),fn,fn2,callback)}return this},fadeTo:function(speed,to,easing,callback){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:to},speed,easing,callback)},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);if(jQuery.isEmptyObject(prop)){return this.each(optall.complete,[false])}return this[optall.queue===false?"each":"queue"](function(){if(optall.queue===false){jQuery._mark(this)}var opt=jQuery.extend({},optall),isElement=this.nodeType===1,hidden=isElement&&jQuery(this).is(":hidden"),name,val,p,display,e,parts,start,end,unit;opt.animatedProperties={};for(p in prop){name=jQuery.camelCase(p);if(p!==name){prop[name]=prop[p];delete prop[p]}val=prop[name];if(val==="hide"&&hidden||val==="show"&&!hidden){return opt.complete.call(this)}if(isElement&&(name==="height"||name==="width")){opt.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(jQuery.css(this,"display")==="inline"&&jQuery.css(this,"float")==="none"){if(!jQuery.support.inlineBlockNeedsLayout){this.style.display="inline-block"}else{display=defaultDisplay(this.nodeName);if(display==="inline"){this.style.display="inline-block"}else{this.style.display="inline";this.style.zoom=1}}}}opt.animatedProperties[name]=jQuery.isArray(val)?val[1]:opt.specialEasing&&opt.specialEasing[name]||opt.easing||"swing"}if(opt.overflow!=null){this.style.overflow="hidden"}for(p in prop){e=new jQuery.fx(this,opt,p);val=prop[p];if(rfxtypes.test(val)){e[val==="toggle"?hidden?"show":"hide":val]()}else{parts=rfxnum.exec(val);start=e.cur();if(parts){end=parseFloat(parts[2]);unit=parts[3]||(jQuery.cssNumber[name]?"":"px");if(unit!=="px"){jQuery.style(this,p,(end||1)+unit);start=(end||1)/e.cur()*start;jQuery.style(this,p,start+unit)}if(parts[1]){end=(parts[1]==="-="?-1:1)*end+start}e.custom(start,end,unit)}else{e.custom(start,val,"")}}}return true})},stop:function(clearQueue,gotoEnd){if(clearQueue){this.queue([])}this.each(function(){var timers=jQuery.timers,i=timers.length;if(!gotoEnd){jQuery._unmark(true,this)}while(i--){if(timers[i].elem===this){if(gotoEnd){timers[i](true)}timers.splice(i,1)}}});if(!gotoEnd){this.dequeue()}return this}});function createFxNow(){setTimeout(clearFxNow,0);return fxNow=jQuery.now()}function clearFxNow(){fxNow=undefined}function genFx(type,num){var obj={};jQuery.each(fxAttrs.concat.apply([],fxAttrs.slice(0,num)),function(){obj[this]=type});return obj}jQuery.each({slideDown:genFx("show",1),slideUp:genFx("hide",1),slideToggle:genFx("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(name,props){jQuery.fn[name]=function(speed,easing,callback){return this.animate(props,speed,easing,callback)}});jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&typeof speed==="object"?jQuery.extend({},speed):{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:opt.duration in jQuery.fx.speeds?jQuery.fx.speeds[opt.duration]:jQuery.fx.speeds._default;opt.old=opt.complete;opt.complete=function(noUnmark){if(opt.queue!==false){jQuery.dequeue(this)}else if(noUnmark!==false){jQuery._unmark(this)}if(jQuery.isFunction(opt.old)){opt.old.call(this)}};return opt},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p},swing:function(p,n,firstNum,diff){return(-Math.cos(p*Math.PI)/2+.5)*diff+firstNum}},timers:[],fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;options.orig=options.orig||{}}});jQuery.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var parsed,r=jQuery.css(this.elem,this.prop);return isNaN(parsed=parseFloat(r))?!r||r==="auto"?0:r:parsed},custom:function(from,to,unit){var self=this,fx=jQuery.fx,raf;this.startTime=fxNow||createFxNow();this.start=from;this.end=to;this.unit=unit||this.unit||(jQuery.cssNumber[this.prop]?"":"px");this.now=this.start;this.pos=this.state=0;function t(gotoEnd){return self.step(gotoEnd)}t.elem=this.elem;if(t()&&jQuery.timers.push(t)&&!timerId){if(requestAnimationFrame){timerId=1;raf=function(){if(timerId){requestAnimationFrame(raf);fx.tick()}};requestAnimationFrame(raf)}else{timerId=setInterval(fx.tick,fx.interval)}}},show:function(){this.options.orig[this.prop]=jQuery.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());jQuery(this.elem).show()},hide:function(){this.options.orig[this.prop]=jQuery.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(gotoEnd){var t=fxNow||createFxNow(),done=true,elem=this.elem,options=this.options,i,n;if(gotoEnd||t>=options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();options.animatedProperties[this.prop]=true;for(i in options.animatedProperties){if(options.animatedProperties[i]!==true){done=false}}if(done){if(options.overflow!=null&&!jQuery.support.shrinkWrapBlocks){jQuery.each(["","X","Y"],function(index,value){elem.style["overflow"+value]=options.overflow[index]})}if(options.hide){jQuery(elem).hide()}if(options.hide||options.show){for(var p in options.animatedProperties){jQuery.style(elem,p,options.orig[p])}}options.complete.call(elem)}return false}else{if(options.duration==Infinity){this.now=t}else{n=t-this.startTime;this.state=n/options.duration;this.pos=jQuery.easing[options.animatedProperties[this.prop]](this.state,n,0,1,options.duration);this.now=this.start+(this.end-this.start)*this.pos}this.update()}return true}};jQuery.extend(jQuery.fx,{tick:function(){var timers=jQuery.timers,i=timers.length;while(i--){if(!timers[i]()){timers.splice(i,1)}}if(!timers.length){jQuery.fx.stop()}},interval:13,stop:function(){clearInterval(timerId);timerId=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(fx){jQuery.style(fx.elem,"opacity",fx.now)},_default:function(fx){if(fx.elem.style&&fx.elem.style[fx.prop]!=null){fx.elem.style[fx.prop]=(fx.prop==="width"||fx.prop==="height"?Math.max(0,fx.now):fx.now)+fx.unit}else{fx.elem[fx.prop]=fx.now}}}});if(jQuery.expr&&jQuery.expr.filters){jQuery.expr.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem}).length}}function defaultDisplay(nodeName){if(!elemdisplay[nodeName]){var elem=jQuery("<"+nodeName+">").appendTo("body"),display=elem.css("display");elem.remove();if(display==="none"||display===""){if(!iframe){iframe=document.createElement("iframe");iframe.frameBorder=iframe.width=iframe.height=0}document.body.appendChild(iframe);if(!iframeDoc||!iframe.createElement){iframeDoc=(iframe.contentWindow||iframe.contentDocument).document;iframeDoc.write("<!doctype><html><body></body></html>")}elem=iframeDoc.createElement(nodeName);iframeDoc.body.appendChild(elem);display=jQuery.css(elem,"display");document.body.removeChild(iframe)}elemdisplay[nodeName]=display}return elemdisplay[nodeName]}var rtable=/^t(?:able|d|h)$/i,rroot=/^(?:body|html)$/i;if("getBoundingClientRect"in document.documentElement){jQuery.fn.offset=function(options){var elem=this[0],box;if(options){return this.each(function(i){jQuery.offset.setOffset(this,options,i)})}if(!elem||!elem.ownerDocument){return null}if(elem===elem.ownerDocument.body){return jQuery.offset.bodyOffset(elem)}try{box=elem.getBoundingClientRect()}catch(e){}var doc=elem.ownerDocument,docElem=doc.documentElement;if(!box||!jQuery.contains(docElem,elem)){return box?{top:box.top,left:box.left}:{top:0,left:0}}var body=doc.body,win=getWindow(doc),clientTop=docElem.clientTop||body.clientTop||0,clientLeft=docElem.clientLeft||body.clientLeft||0,scrollTop=win.pageYOffset||jQuery.support.boxModel&&docElem.scrollTop||body.scrollTop,scrollLeft=win.pageXOffset||jQuery.support.boxModel&&docElem.scrollLeft||body.scrollLeft,top=box.top+scrollTop-clientTop,left=box.left+scrollLeft-clientLeft;return{top:top,left:left}}}else{jQuery.fn.offset=function(options){var elem=this[0];if(options){return this.each(function(i){jQuery.offset.setOffset(this,options,i)})}if(!elem||!elem.ownerDocument){return null}if(elem===elem.ownerDocument.body){return jQuery.offset.bodyOffset(elem)}jQuery.offset.initialize();var computedStyle,offsetParent=elem.offsetParent,prevOffsetParent=elem,doc=elem.ownerDocument,docElem=doc.documentElement,body=doc.body,defaultView=doc.defaultView,prevComputedStyle=defaultView?defaultView.getComputedStyle(elem,null):elem.currentStyle,top=elem.offsetTop,left=elem.offsetLeft;while((elem=elem.parentNode)&&elem!==body&&elem!==docElem){if(jQuery.offset.supportsFixedPosition&&prevComputedStyle.position==="fixed"){break}computedStyle=defaultView?defaultView.getComputedStyle(elem,null):elem.currentStyle;top-=elem.scrollTop;left-=elem.scrollLeft;if(elem===offsetParent){top+=elem.offsetTop;left+=elem.offsetLeft;if(jQuery.offset.doesNotAddBorder&&!(jQuery.offset.doesAddBorderForTableAndCells&&rtable.test(elem.nodeName))){top+=parseFloat(computedStyle.borderTopWidth)||0;left+=parseFloat(computedStyle.borderLeftWidth)||0}prevOffsetParent=offsetParent;offsetParent=elem.offsetParent}if(jQuery.offset.subtractsBorderForOverflowNotVisible&&computedStyle.overflow!=="visible"){top+=parseFloat(computedStyle.borderTopWidth)||0;left+=parseFloat(computedStyle.borderLeftWidth)||0}prevComputedStyle=computedStyle}if(prevComputedStyle.position==="relative"||prevComputedStyle.position==="static"){top+=body.offsetTop;left+=body.offsetLeft}if(jQuery.offset.supportsFixedPosition&&prevComputedStyle.position==="fixed"){top+=Math.max(docElem.scrollTop,body.scrollTop);left+=Math.max(docElem.scrollLeft,body.scrollLeft)}return{top:top,left:left}}}jQuery.offset={initialize:function(){var body=document.body,container=document.createElement("div"),innerDiv,checkDiv,table,td,bodyMarginTop=parseFloat(jQuery.css(body,"marginTop"))||0,html="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";jQuery.extend(container.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});container.innerHTML=html;body.insertBefore(container,body.firstChild);innerDiv=container.firstChild;checkDiv=innerDiv.firstChild;td=innerDiv.nextSibling.firstChild.firstChild;this.doesNotAddBorder=checkDiv.offsetTop!==5;this.doesAddBorderForTableAndCells=td.offsetTop===5;checkDiv.style.position="fixed";checkDiv.style.top="20px";this.supportsFixedPosition=checkDiv.offsetTop===20||checkDiv.offsetTop===15;checkDiv.style.position=checkDiv.style.top="";innerDiv.style.overflow="hidden";innerDiv.style.position="relative";this.subtractsBorderForOverflowNotVisible=checkDiv.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=body.offsetTop!==bodyMarginTop;body.removeChild(container);jQuery.offset.initialize=jQuery.noop},bodyOffset:function(body){var top=body.offsetTop,left=body.offsetLeft;
jQuery.offset.initialize();if(jQuery.offset.doesNotIncludeMarginInBodyOffset){top+=parseFloat(jQuery.css(body,"marginTop"))||0;left+=parseFloat(jQuery.css(body,"marginLeft"))||0}return{top:top,left:left}},setOffset:function(elem,options,i){var position=jQuery.css(elem,"position");if(position==="static"){elem.style.position="relative"}var curElem=jQuery(elem),curOffset=curElem.offset(),curCSSTop=jQuery.css(elem,"top"),curCSSLeft=jQuery.css(elem,"left"),calculatePosition=(position==="absolute"||position==="fixed")&&jQuery.inArray("auto",[curCSSTop,curCSSLeft])>-1,props={},curPosition={},curTop,curLeft;if(calculatePosition){curPosition=curElem.position();curTop=curPosition.top;curLeft=curPosition.left}else{curTop=parseFloat(curCSSTop)||0;curLeft=parseFloat(curCSSLeft)||0}if(jQuery.isFunction(options)){options=options.call(elem,i,curOffset)}if(options.top!=null){props.top=options.top-curOffset.top+curTop}if(options.left!=null){props.left=options.left-curOffset.left+curLeft}if("using"in options){options.using.call(elem,props)}else{curElem.css(props)}}};jQuery.fn.extend({position:function(){if(!this[0]){return null}var elem=this[0],offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=rroot.test(offsetParent[0].nodeName)?{top:0,left:0}:offsetParent.offset();offset.top-=parseFloat(jQuery.css(elem,"marginTop"))||0;offset.left-=parseFloat(jQuery.css(elem,"marginLeft"))||0;parentOffset.top+=parseFloat(jQuery.css(offsetParent[0],"borderTopWidth"))||0;parentOffset.left+=parseFloat(jQuery.css(offsetParent[0],"borderLeftWidth"))||0;return{top:offset.top-parentOffset.top,left:offset.left-parentOffset.left}},offsetParent:function(){return this.map(function(){var offsetParent=this.offsetParent||document.body;while(offsetParent&&(!rroot.test(offsetParent.nodeName)&&jQuery.css(offsetParent,"position")==="static")){offsetParent=offsetParent.offsetParent}return offsetParent})}});jQuery.each(["Left","Top"],function(i,name){var method="scroll"+name;jQuery.fn[method]=function(val){var elem,win;if(val===undefined){elem=this[0];if(!elem){return null}win=getWindow(elem);return win?"pageXOffset"in win?win[i?"pageYOffset":"pageXOffset"]:jQuery.support.boxModel&&win.document.documentElement[method]||win.document.body[method]:elem[method]}return this.each(function(){win=getWindow(this);if(win){win.scrollTo(!i?val:jQuery(win).scrollLeft(),i?val:jQuery(win).scrollTop())}else{this[method]=val}})}});function getWindow(elem){return jQuery.isWindow(elem)?elem:elem.nodeType===9?elem.defaultView||elem.parentWindow:false}jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn["inner"+name]=function(){return this[0]?parseFloat(jQuery.css(this[0],type,"padding")):null};jQuery.fn["outer"+name]=function(margin){return this[0]?parseFloat(jQuery.css(this[0],type,margin?"margin":"border")):null};jQuery.fn[type]=function(size){var elem=this[0];if(!elem){return size==null?null:this}if(jQuery.isFunction(size)){return this.each(function(i){var self=jQuery(this);self[type](size.call(this,i,self[type]()))})}if(jQuery.isWindow(elem)){var docElemProp=elem.document.documentElement["client"+name];return elem.document.compatMode==="CSS1Compat"&&docElemProp||elem.document.body["client"+name]||docElemProp}else if(elem.nodeType===9){return Math.max(elem.documentElement["client"+name],elem.body["scroll"+name],elem.documentElement["scroll"+name],elem.body["offset"+name],elem.documentElement["offset"+name])}else if(size===undefined){var orig=jQuery.css(elem,type),ret=parseFloat(orig);return jQuery.isNaN(ret)?orig:ret}else{return this.css(type,typeof size==="string"?size:size+"px")}}});window.jQuery=window.$=jQuery})(window);(function($,undefined){$.ui=$.ui||{};if($.ui.version){return}$.extend($.ui,{version:"1.8.12",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});$.fn.extend({_focus:$.fn.focus,focus:function(delay,fn){return typeof delay==="number"?this.each(function(){var elem=this;setTimeout(function(){$(elem).focus();if(fn){fn.call(elem)}},delay)}):this._focus.apply(this,arguments)},scrollParent:function(){var scrollParent;if($.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))){scrollParent=this.parents().filter(function(){return/(relative|absolute|fixed)/.test($.curCSS(this,"position",1))&&/(auto|scroll)/.test($.curCSS(this,"overflow",1)+$.curCSS(this,"overflow-y",1)+$.curCSS(this,"overflow-x",1))}).eq(0)}else{scrollParent=this.parents().filter(function(){return/(auto|scroll)/.test($.curCSS(this,"overflow",1)+$.curCSS(this,"overflow-y",1)+$.curCSS(this,"overflow-x",1))}).eq(0)}return/fixed/.test(this.css("position"))||!scrollParent.length?$(document):scrollParent},zIndex:function(zIndex){if(zIndex!==undefined){return this.css("zIndex",zIndex)}if(this.length){var elem=$(this[0]),position,value;while(elem.length&&elem[0]!==document){position=elem.css("position");if(position==="absolute"||position==="relative"||position==="fixed"){value=parseInt(elem.css("zIndex"),10);if(!isNaN(value)&&value!==0){return value}}elem=elem.parent()}}return 0},disableSelection:function(){return this.bind(($.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(event){event.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});$.each(["Width","Height"],function(i,name){var side=name==="Width"?["Left","Right"]:["Top","Bottom"],type=name.toLowerCase(),orig={innerWidth:$.fn.innerWidth,innerHeight:$.fn.innerHeight,outerWidth:$.fn.outerWidth,outerHeight:$.fn.outerHeight};function reduce(elem,size,border,margin){$.each(side,function(){size-=parseFloat($.curCSS(elem,"padding"+this,true))||0;if(border){size-=parseFloat($.curCSS(elem,"border"+this+"Width",true))||0}if(margin){size-=parseFloat($.curCSS(elem,"margin"+this,true))||0}});return size}$.fn["inner"+name]=function(size){if(size===undefined){return orig["inner"+name].call(this)}return this.each(function(){$(this).css(type,reduce(this,size)+"px")})};$.fn["outer"+name]=function(size,margin){if(typeof size!=="number"){return orig["outer"+name].call(this,size)}return this.each(function(){$(this).css(type,reduce(this,size,true,margin)+"px")})}});function visible(element){return!$(element).parents().andSelf().filter(function(){return $.curCSS(this,"visibility")==="hidden"||$.expr.filters.hidden(this)}).length}$.extend($.expr[":"],{data:function(elem,i,match){return!!$.data(elem,match[3])},focusable:function(element){var nodeName=element.nodeName.toLowerCase(),tabIndex=$.attr(element,"tabindex");if("area"===nodeName){var map=element.parentNode,mapName=map.name,img;if(!element.href||!mapName||map.nodeName.toLowerCase()!=="map"){return false}img=$("img[usemap=#"+mapName+"]")[0];return!!img&&visible(img)}return(/input|select|textarea|button|object/.test(nodeName)?!element.disabled:"a"==nodeName?element.href||!isNaN(tabIndex):!isNaN(tabIndex))&&visible(element)},tabbable:function(element){var tabIndex=$.attr(element,"tabindex");return(isNaN(tabIndex)||tabIndex>=0)&&$(element).is(":focusable")}});$(function(){var body=document.body,div=body.appendChild(div=document.createElement("div"));$.extend(div.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});$.support.minHeight=div.offsetHeight===100;$.support.selectstart="onselectstart"in div;body.removeChild(div).style.display="none"});$.extend($.ui,{plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]])}},call:function(instance,name,args){var set=instance.plugins[name];if(!set||!instance.element[0].parentNode){return}for(var i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args)}}}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(el,a){if($(el).css("overflow")==="hidden"){return false}var scroll=a&&a==="left"?"scrollLeft":"scrollTop",has=false;if(el[scroll]>0){return true}el[scroll]=1;has=el[scroll]>0;el[scroll]=0;return has},isOverAxis:function(x,reference,size){return x>reference&&x<reference+size},isOver:function(y,x,top,left,height,width){return $.ui.isOverAxis(y,top,height)&&$.ui.isOverAxis(x,left,width)}})})(jQuery);(function($,undefined){if($.cleanData){var _cleanData=$.cleanData;$.cleanData=function(elems){for(var i=0,elem;(elem=elems[i])!=null;i++){$(elem).triggerHandler("remove")}_cleanData(elems)}}else{var _remove=$.fn.remove;$.fn.remove=function(selector,keepData){return this.each(function(){if(!keepData){if(!selector||$.filter(selector,[this]).length){$("*",this).add([this]).each(function(){$(this).triggerHandler("remove")})}}return _remove.call($(this),selector,keepData)})}}$.widget=function(name,base,prototype){var namespace=name.split(".")[0],fullName;name=name.split(".")[1];fullName=namespace+"-"+name;if(!prototype){prototype=base;base=$.Widget}$.expr[":"][fullName]=function(elem){return!!$.data(elem,name)};$[namespace]=$[namespace]||{};$[namespace][name]=function(options,element){if(arguments.length){this._createWidget(options,element)}};var basePrototype=new base;basePrototype.options=$.extend(true,{},basePrototype.options);$[namespace][name].prototype=$.extend(true,basePrototype,{namespace:namespace,widgetName:name,widgetEventPrefix:$[namespace][name].prototype.widgetEventPrefix||name,widgetBaseClass:fullName},prototype);$.widget.bridge(name,$[namespace][name])};$.widget.bridge=function(name,object){$.fn[name]=function(options){var isMethodCall=typeof options==="string",args=Array.prototype.slice.call(arguments,1),returnValue=this;options=!isMethodCall&&args.length?$.extend.apply(null,[true,options].concat(args)):options;if(isMethodCall&&options.charAt(0)==="_"){return returnValue}if(isMethodCall){this.each(function(){var instance=$.data(this,name),methodValue=instance&&$.isFunction(instance[options])?instance[options].apply(instance,args):instance;if(methodValue!==instance&&methodValue!==undefined){returnValue=methodValue;return false}})}else{this.each(function(){var instance=$.data(this,name);if(instance){instance.option(options||{})._init()}else{$.data(this,name,new object(options,this))}})}return returnValue}};$.Widget=function(options,element){if(arguments.length){this._createWidget(options,element)}};$.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(options,element){$.data(element,this.widgetName,this);this.element=$(element);this.options=$.extend(true,{},this.options,this._getCreateOptions(),options);var self=this;this.element.bind("remove."+this.widgetName,function(){self.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return $.metadata&&$.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+"ui-state-disabled")},widget:function(){return this.element},option:function(key,value){var options=key;if(arguments.length===0){return $.extend({},this.options)}if(typeof key==="string"){if(value===undefined){return this.options[key]}options={};options[key]=value}this._setOptions(options);return this},_setOptions:function(options){var self=this;$.each(options,function(key,value){self._setOption(key,value)});return this},_setOption:function(key,value){this.options[key]=value;if(key==="disabled"){this.widget()[value?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+"ui-state-disabled").attr("aria-disabled",value)}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(type,event,data){var callback=this.options[type];event=$.Event(event);event.type=(type===this.widgetEventPrefix?type:this.widgetEventPrefix+type).toLowerCase();data=data||{};if(event.originalEvent){for(var i=$.event.props.length,prop;i;){prop=$.event.props[--i];event[prop]=event.originalEvent[prop]}}this.element.trigger(event,data);return!($.isFunction(callback)&&callback.call(this.element[0],event,data)===false||event.isDefaultPrevented())}}})(jQuery);(function($,undefined){$.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var self=this;this.element.bind("mousedown."+this.widgetName,function(event){return self._mouseDown(event)}).bind("click."+this.widgetName,function(event){if(true===$.data(event.target,self.widgetName+".preventClickEvent")){$.removeData(event.target,self.widgetName+".preventClickEvent");event.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(event){event.originalEvent=event.originalEvent||{};if(event.originalEvent.mouseHandled){return}this._mouseStarted&&this._mouseUp(event);this._mouseDownEvent=event;var self=this,btnIsLeft=event.which==1,elIsCancel=typeof this.options.cancel=="string"?$(event.target).parents().add(event.target).filter(this.options.cancel).length:false;if(!btnIsLeft||elIsCancel||!this._mouseCapture(event)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){self.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=this._mouseStart(event)!==false;if(!this._mouseStarted){event.preventDefault();return true}}if(true===$.data(event.target,this.widgetName+".preventClickEvent")){$.removeData(event.target,this.widgetName+".preventClickEvent")}this._mouseMoveDelegate=function(event){return self._mouseMove(event)};this._mouseUpDelegate=function(event){return self._mouseUp(event)};$(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);event.preventDefault();event.originalEvent.mouseHandled=true;return true},_mouseMove:function(event){if($.browser.msie&&!(document.documentMode>=9)&&!event.button){return this._mouseUp(event)}if(this._mouseStarted){this._mouseDrag(event);return event.preventDefault()}if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=this._mouseStart(this._mouseDownEvent,event)!==false;this._mouseStarted?this._mouseDrag(event):this._mouseUp(event)}return!this._mouseStarted},_mouseUp:function(event){$(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(event.target==this._mouseDownEvent.target){$.data(event.target,this.widgetName+".preventClickEvent",true)}this._mouseStop(event)}return false},_mouseDistanceMet:function(event){return Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance},_mouseDelayMet:function(event){return this.mouseDelayMet},_mouseStart:function(event){},_mouseDrag:function(event){},_mouseStop:function(event){},_mouseCapture:function(event){return true}})})(jQuery);(function($,undefined){$.widget("ui.draggable",$.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(!this.element.data("draggable"))return;this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable"+" ui-draggable-dragging"+" ui-draggable-disabled");this._mouseDestroy();return this},_mouseCapture:function(event){var o=this.options;if(this.helper||o.disabled||$(event.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(event);if(!this.handle)return false;return true},_mouseStart:function(event){var o=this.options;this.helper=this._createHelper(event);this._cacheHelperProportions();if($.ui.ddmanager)$.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt);if(o.containment)this._setContainment();if(this._trigger("start",event)===false){this._clear();return false}this._cacheHelperProportions();if($.ui.ddmanager&&!o.dropBehaviour)$.ui.ddmanager.prepareOffsets(this,event);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(event,true);return true},_mouseDrag:function(event,noPropagation){this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!noPropagation){var ui=this._uiHash();if(this._trigger("drag",event,ui)===false){this._mouseUp({});return false}this.position=ui.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";if($.ui.ddmanager)$.ui.ddmanager.drag(this,event);return false},_mouseStop:function(event){var dropped=false;if($.ui.ddmanager&&!this.options.dropBehaviour)dropped=$.ui.ddmanager.drop(this,event);if(this.dropped){dropped=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!dropped||this.options.revert=="valid"&&dropped||this.options.revert===true||$.isFunction(this.options.revert)&&this.options.revert.call(this.element,dropped)){var self=this;$(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){if(self._trigger("stop",event)!==false){self._clear()}})}else{if(this._trigger("stop",event)!==false){this._clear()}}return false},cancel:function(){if(this.helper.is(".ui-draggable-dragging")){this._mouseUp({})}else{this._clear()}return this},_getHandle:function(event){var handle=!this.options.handle||!$(this.options.handle,this.element).length?true:false;$(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==event.target)handle=true});return handle},_createHelper:function(event){var o=this.options;var helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event])):o.helper=="clone"?this.element.clone():this.element;if(!helper.parents("body").length)helper.appendTo(o.appendTo=="parent"?this.element[0].parentNode:o.appendTo);if(helper[0]!=this.element[0]&&!/(fixed|absolute)/.test(helper.css("position")))helper.css("position","absolute");return helper},_adjustOffsetFromHelper:function(obj){if(typeof obj=="string"){obj=obj.split(" ")}if($.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0}}if("left"in obj){this.offset.click.left=obj.left+this.margins.left}if("right"in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left}if("top"in obj){this.offset.click.top=obj.top+this.margins.top}if("bottom"in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&$.browser.msie)po={top:0,left:0};return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var p=this.element.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var o=this.options;if(o.containment=="parent")o.containment=this.helper[0].parentNode;if(o.containment=="document"||o.containment=="window")this.containment=[(o.containment=="document"?0:$(window).scrollLeft())-this.offset.relative.left-this.offset.parent.left,(o.containment=="document"?0:$(window).scrollTop())-this.offset.relative.top-this.offset.parent.top,(o.containment=="document"?0:$(window).scrollLeft())+$(o.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(o.containment=="document"?0:$(window).scrollTop())+($(o.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(o.containment)&&o.containment.constructor!=Array){var ce=$(o.containment)[0];if(!ce)return;var co=$(o.containment).offset();var over=$(ce).css("overflow")!="hidden";this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)+(parseInt($(ce).css("paddingLeft"),10)||0),co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)+(parseInt($(ce).css("paddingTop"),10)||0),co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-(parseInt($(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-(parseInt($(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom]}else if(o.containment.constructor==Array){this.containment=o.containment}},_convertPositionTo:function(d,pos){if(!pos)pos=this.position;var mod=d=="absolute"?1:-1;var o=this.options,scroll=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=/(html|body)/i.test(scroll[0].tagName);return{top:pos.top+this.offset.relative.top*mod+this.offset.parent.top*mod-($.browser.safari&&$.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():scrollIsRootNode?0:scroll.scrollTop())*mod),left:pos.left+this.offset.relative.left*mod+this.offset.parent.left*mod-($.browser.safari&&$.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod)}},_generatePosition:function(event){var o=this.options,scroll=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=/(html|body)/i.test(scroll[0].tagName);var pageX=event.pageX;var pageY=event.pageY;if(this.originalPosition){if(this.containment){if(event.pageX-this.offset.click.left<this.containment[0])pageX=this.containment[0]+this.offset.click.left;if(event.pageY-this.offset.click.top<this.containment[1])pageY=this.containment[1]+this.offset.click.top;if(event.pageX-this.offset.click.left>this.containment[2])pageX=this.containment[2]+this.offset.click.left;if(event.pageY-this.offset.click.top>this.containment[3])pageY=this.containment[3]+this.offset.click.top}if(o.grid){var top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?!(top-this.offset.click.top<this.containment[1]||top-this.offset.click.top>this.containment[3])?top:!(top-this.offset.click.top<this.containment[1])?top-o.grid[1]:top+o.grid[1]:top;var left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0];pageX=this.containment?!(left-this.offset.click.left<this.containment[0]||left-this.offset.click.left>this.containment[2])?left:!(left-this.offset.click.left<this.containment[0])?left-o.grid[0]:left+o.grid[0]:left}}return{top:pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+($.browser.safari&&$.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():scrollIsRootNode?0:scroll.scrollTop()),left:pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+($.browser.safari&&$.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval)this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(type,event,ui){ui=ui||this._uiHash();$.ui.plugin.call(this,type,[event,ui]);if(type=="drag")this.positionAbs=this._convertPositionTo("absolute");return $.Widget.prototype._trigger.call(this,type,event,ui)},plugins:{},_uiHash:function(event){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});$.extend($.ui.draggable,{version:"1.8.12"});$.ui.plugin.add("draggable","connectToSortable",{start:function(event,ui){var inst=$(this).data("draggable"),o=inst.options,uiSortable=$.extend({},ui,{item:inst.element});inst.sortables=[];$(o.connectToSortable).each(function(){var sortable=$.data(this,"sortable");if(sortable&&!sortable.options.disabled){inst.sortables.push({instance:sortable,shouldRevert:sortable.options.revert});sortable.refreshPositions();sortable._trigger("activate",event,uiSortable)}})},stop:function(event,ui){var inst=$(this).data("draggable"),uiSortable=$.extend({},ui,{item:inst.element});$.each(inst.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;inst.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(event);this.instance.options.helper=this.instance.options._helper;if(inst.options.helper=="original")this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",event,uiSortable)}})},drag:function(event,ui){var inst=$(this).data("draggable"),self=this;var checkPos=function(o){var dyClick=this.offset.click.top,dxClick=this.offset.click.left;var helperTop=this.positionAbs.top,helperLeft=this.positionAbs.left;var itemHeight=o.height,itemWidth=o.width;var itemTop=o.top,itemLeft=o.left;return $.ui.isOver(helperTop+dyClick,helperLeft+dxClick,itemTop,itemLeft,itemHeight,itemWidth)};$.each(inst.sortables,function(i){this.instance.positionAbs=inst.positionAbs;this.instance.helperProportions=inst.helperProportions;this.instance.offset.click=inst.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=$(self).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return ui.helper[0]};event.target=this.instance.currentItem[0];this.instance._mouseCapture(event,true);this.instance._mouseStart(event,true,true);this.instance.offset.click.top=inst.offset.click.top;this.instance.offset.click.left=inst.offset.click.left;this.instance.offset.parent.left-=inst.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=inst.offset.parent.top-this.instance.offset.parent.top;inst._trigger("toSortable",event);inst.dropped=this.instance.element;inst.currentItem=inst.element;this.instance.fromOutside=inst}if(this.instance.currentItem)this.instance._mouseDrag(event)}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",event,this.instance._uiHash(this.instance));this.instance._mouseStop(event,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder)this.instance.placeholder.remove();inst._trigger("fromSortable",event);inst.dropped=false}}})}});$.ui.plugin.add("draggable","cursor",{start:function(event,ui){var t=$("body"),o=$(this).data("draggable").options;if(t.css("cursor"))o._cursor=t.css("cursor");t.css("cursor",o.cursor)},stop:function(event,ui){var o=$(this).data("draggable").options;if(o._cursor)$("body").css("cursor",o._cursor)}});$.ui.plugin.add("draggable","iframeFix",{start:function(event,ui){var o=$(this).data("draggable").options;$(o.iframeFix===true?"iframe":o.iframeFix).each(function(){$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css($(this).offset()).appendTo("body")})},stop:function(event,ui){$("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});$.ui.plugin.add("draggable","opacity",{start:function(event,ui){var t=$(ui.helper),o=$(this).data("draggable").options;if(t.css("opacity"))o._opacity=t.css("opacity");t.css("opacity",o.opacity)},stop:function(event,ui){var o=$(this).data("draggable").options;if(o._opacity)$(ui.helper).css("opacity",o._opacity)}});$.ui.plugin.add("draggable","scroll",{start:function(event,ui){var i=$(this).data("draggable");if(i.scrollParent[0]!=document&&i.scrollParent[0].tagName!="HTML")i.overflowOffset=i.scrollParent.offset()},drag:function(event,ui){var i=$(this).data("draggable"),o=i.options,scrolled=false;if(i.scrollParent[0]!=document&&i.scrollParent[0].tagName!="HTML"){if(!o.axis||o.axis!="x"){if(i.overflowOffset.top+i.scrollParent[0].offsetHeight-event.pageY<o.scrollSensitivity)i.scrollParent[0].scrollTop=scrolled=i.scrollParent[0].scrollTop+o.scrollSpeed;else if(event.pageY-i.overflowOffset.top<o.scrollSensitivity)i.scrollParent[0].scrollTop=scrolled=i.scrollParent[0].scrollTop-o.scrollSpeed}if(!o.axis||o.axis!="y"){if(i.overflowOffset.left+i.scrollParent[0].offsetWidth-event.pageX<o.scrollSensitivity)i.scrollParent[0].scrollLeft=scrolled=i.scrollParent[0].scrollLeft+o.scrollSpeed;else if(event.pageX-i.overflowOffset.left<o.scrollSensitivity)i.scrollParent[0].scrollLeft=scrolled=i.scrollParent[0].scrollLeft-o.scrollSpeed}}else{if(!o.axis||o.axis!="x"){if(event.pageY-$(document).scrollTop()<o.scrollSensitivity)scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity)scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);
}if(!o.axis||o.axis!="y"){if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity)scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity)scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed)}}if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour)$.ui.ddmanager.prepareOffsets(i,event)}});$.ui.plugin.add("draggable","snap",{start:function(event,ui){var i=$(this).data("draggable"),o=i.options;i.snapElements=[];$(o.snap.constructor!=String?o.snap.items||":data(draggable)":o.snap).each(function(){var $t=$(this);var $o=$t.offset();if(this!=i.element[0])i.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left})})},drag:function(event,ui){var inst=$(this).data("draggable"),o=inst.options;var d=o.snapTolerance;var x1=ui.offset.left,x2=x1+inst.helperProportions.width,y1=ui.offset.top,y2=y1+inst.helperProportions.height;for(var i=inst.snapElements.length-1;i>=0;i--){var l=inst.snapElements[i].left,r=l+inst.snapElements[i].width,t=inst.snapElements[i].top,b=t+inst.snapElements[i].height;if(!(l-d<x1&&x1<r+d&&t-d<y1&&y1<b+d||l-d<x1&&x1<r+d&&t-d<y2&&y2<b+d||l-d<x2&&x2<r+d&&t-d<y1&&y1<b+d||l-d<x2&&x2<r+d&&t-d<y2&&y2<b+d)){if(inst.snapElements[i].snapping)inst.options.snap.release&&inst.options.snap.release.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item}));inst.snapElements[i].snapping=false;continue}if(o.snapMode!="inner"){var ts=Math.abs(t-y2)<=d;var bs=Math.abs(b-y1)<=d;var ls=Math.abs(l-x2)<=d;var rs=Math.abs(r-x1)<=d;if(ts)ui.position.top=inst._convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top-inst.margins.top;if(bs)ui.position.top=inst._convertPositionTo("relative",{top:b,left:0}).top-inst.margins.top;if(ls)ui.position.left=inst._convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left-inst.margins.left;if(rs)ui.position.left=inst._convertPositionTo("relative",{top:0,left:r}).left-inst.margins.left}var first=ts||bs||ls||rs;if(o.snapMode!="outer"){var ts=Math.abs(t-y1)<=d;var bs=Math.abs(b-y2)<=d;var ls=Math.abs(l-x1)<=d;var rs=Math.abs(r-x2)<=d;if(ts)ui.position.top=inst._convertPositionTo("relative",{top:t,left:0}).top-inst.margins.top;if(bs)ui.position.top=inst._convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top-inst.margins.top;if(ls)ui.position.left=inst._convertPositionTo("relative",{top:0,left:l}).left-inst.margins.left;if(rs)ui.position.left=inst._convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left-inst.margins.left}if(!inst.snapElements[i].snapping&&(ts||bs||ls||rs||first))inst.options.snap.snap&&inst.options.snap.snap.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item}));inst.snapElements[i].snapping=ts||bs||ls||rs||first}}});$.ui.plugin.add("draggable","stack",{start:function(event,ui){var o=$(this).data("draggable").options;var group=$.makeArray($(o.stack)).sort(function(a,b){return(parseInt($(a).css("zIndex"),10)||0)-(parseInt($(b).css("zIndex"),10)||0)});if(!group.length){return}var min=parseInt(group[0].style.zIndex)||0;$(group).each(function(i){this.style.zIndex=min+i});this[0].style.zIndex=min+group.length}});$.ui.plugin.add("draggable","zIndex",{start:function(event,ui){var t=$(ui.helper),o=$(this).data("draggable").options;if(t.css("zIndex"))o._zIndex=t.css("zIndex");t.css("zIndex",o.zIndex)},stop:function(event,ui){var o=$(this).data("draggable").options;if(o._zIndex)$(ui.helper).css("zIndex",o._zIndex)}})})(jQuery);(function($,undefined){$.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"},_create:function(){var o=this.options,accept=o.accept;this.isover=0;this.isout=1;this.accept=$.isFunction(accept)?accept:function(d){return d.is(accept)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};$.ui.ddmanager.droppables[o.scope]=$.ui.ddmanager.droppables[o.scope]||[];$.ui.ddmanager.droppables[o.scope].push(this);o.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){var drop=$.ui.ddmanager.droppables[this.options.scope];for(var i=0;i<drop.length;i++)if(drop[i]==this)drop.splice(i,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(key,value){if(key=="accept"){this.accept=$.isFunction(value)?value:function(d){return d.is(value)}}$.Widget.prototype._setOption.apply(this,arguments)},_activate:function(event){var draggable=$.ui.ddmanager.current;if(this.options.activeClass)this.element.addClass(this.options.activeClass);draggable&&this._trigger("activate",event,this.ui(draggable))},_deactivate:function(event){var draggable=$.ui.ddmanager.current;if(this.options.activeClass)this.element.removeClass(this.options.activeClass);draggable&&this._trigger("deactivate",event,this.ui(draggable))},_over:function(event){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return;if(this.accept.call(this.element[0],draggable.currentItem||draggable.element)){if(this.options.hoverClass)this.element.addClass(this.options.hoverClass);this._trigger("over",event,this.ui(draggable))}},_out:function(event){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return;if(this.accept.call(this.element[0],draggable.currentItem||draggable.element)){if(this.options.hoverClass)this.element.removeClass(this.options.hoverClass);this._trigger("out",event,this.ui(draggable))}},_drop:function(event,custom){var draggable=custom||$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return false;var childrenIntersection=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var inst=$.data(this,"droppable");if(inst.options.greedy&&!inst.options.disabled&&inst.options.scope==draggable.options.scope&&inst.accept.call(inst.element[0],draggable.currentItem||draggable.element)&&$.ui.intersect(draggable,$.extend(inst,{offset:inst.element.offset()}),inst.options.tolerance)){childrenIntersection=true;return false}});if(childrenIntersection)return false;if(this.accept.call(this.element[0],draggable.currentItem||draggable.element)){if(this.options.activeClass)this.element.removeClass(this.options.activeClass);if(this.options.hoverClass)this.element.removeClass(this.options.hoverClass);this._trigger("drop",event,this.ui(draggable));return this.element}return false},ui:function(c){return{draggable:c.currentItem||c.element,helper:c.helper,position:c.position,offset:c.positionAbs}}});$.extend($.ui.droppable,{version:"1.8.12"});$.ui.intersect=function(draggable,droppable,toleranceMode){if(!droppable.offset)return false;var x1=(draggable.positionAbs||draggable.position.absolute).left,x2=x1+draggable.helperProportions.width,y1=(draggable.positionAbs||draggable.position.absolute).top,y2=y1+draggable.helperProportions.height;var l=droppable.offset.left,r=l+droppable.proportions.width,t=droppable.offset.top,b=t+droppable.proportions.height;switch(toleranceMode){case"fit":return l<=x1&&x2<=r&&t<=y1&&y2<=b;break;case"intersect":return l<x1+draggable.helperProportions.width/2&&x2-draggable.helperProportions.width/2<r&&t<y1+draggable.helperProportions.height/2&&y2-draggable.helperProportions.height/2<b;break;case"pointer":var draggableLeft=(draggable.positionAbs||draggable.position.absolute).left+(draggable.clickOffset||draggable.offset.click).left,draggableTop=(draggable.positionAbs||draggable.position.absolute).top+(draggable.clickOffset||draggable.offset.click).top,isOver=$.ui.isOver(draggableTop,draggableLeft,t,l,droppable.proportions.height,droppable.proportions.width);return isOver;break;case"touch":return(y1>=t&&y1<=b||y2>=t&&y2<=b||y1<t&&y2>b)&&(x1>=l&&x1<=r||x2>=l&&x2<=r||x1<l&&x2>r);break;default:return false;break}};$.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,event){var m=$.ui.ddmanager.droppables[t.options.scope]||[];var type=event?event.type:null;var list=(t.currentItem||t.element).find(":data(droppable)").andSelf();droppablesLoop:for(var i=0;i<m.length;i++){if(m[i].options.disabled||t&&!m[i].accept.call(m[i].element[0],t.currentItem||t.element))continue;for(var j=0;j<list.length;j++){if(list[j]==m[i].element[0]){m[i].proportions.height=0;continue droppablesLoop}}m[i].visible=m[i].element.css("display")!="none";if(!m[i].visible)continue;if(type=="mousedown")m[i]._activate.call(m[i],event);m[i].offset=m[i].element.offset();m[i].proportions={width:m[i].element[0].offsetWidth,height:m[i].element[0].offsetHeight}}},drop:function(draggable,event){var dropped=false;$.each($.ui.ddmanager.droppables[draggable.options.scope]||[],function(){if(!this.options)return;if(!this.options.disabled&&this.visible&&$.ui.intersect(draggable,this,this.options.tolerance))dropped=dropped||this._drop.call(this,event);if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],draggable.currentItem||draggable.element)){this.isout=1;this.isover=0;this._deactivate.call(this,event)}});return dropped},drag:function(draggable,event){if(draggable.options.refreshPositions)$.ui.ddmanager.prepareOffsets(draggable,event);$.each($.ui.ddmanager.droppables[draggable.options.scope]||[],function(){if(this.options.disabled||this.greedyChild||!this.visible)return;var intersects=$.ui.intersect(draggable,this,this.options.tolerance);var c=!intersects&&this.isover==1?"isout":intersects&&this.isover==0?"isover":null;if(!c)return;var parentInstance;if(this.options.greedy){var parent=this.element.parents(":data(droppable):eq(0)");if(parent.length){parentInstance=$.data(parent[0],"droppable");parentInstance.greedyChild=c=="isover"?1:0}}if(parentInstance&&c=="isover"){parentInstance["isover"]=0;parentInstance["isout"]=1;parentInstance._out.call(parentInstance,event)}this[c]=1;this[c=="isout"?"isover":"isout"]=0;this[c=="isover"?"_over":"_out"].call(this,event);if(parentInstance&&c=="isout"){parentInstance["isout"]=0;parentInstance["isover"]=1;parentInstance._over.call(parentInstance,event)}})}}})(jQuery);(function($,undefined){$.widget("ui.resizable",$.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1e3},_create:function(){var self=this,o=this.options;this.element.addClass("ui-resizable");$.extend(this,{_aspectRatio:!!o.aspectRatio,aspectRatio:o.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:o.helper||o.ghost||o.animate?o.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&$.browser.opera)this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap($('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=o.handles||(!$(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var n=this.handles.split(",");this.handles={};for(var i=0;i<n.length;i++){var handle=$.trim(n[i]),hname="ui-resizable-"+handle;var axis=$('<div class="ui-resizable-handle '+hname+'"></div>');if(/sw|se|ne|nw/.test(handle))axis.css({zIndex:++o.zIndex});if("se"==handle){axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[handle]=".ui-resizable-"+handle;this.element.append(axis)}}this._renderAxis=function(target){target=target||this.element;for(var i in this.handles){if(this.handles[i].constructor==String)this.handles[i]=$(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var axis=$(this.handles[i],this.element),padWrapper=0;padWrapper=/sw|ne|nw|se|n|s/.test(i)?axis.outerHeight():axis.outerWidth();var padPos=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");target.css(padPos,padWrapper);this._proportionallyResize()}if(!$(this.handles[i]).length)continue}};this._renderAxis(this.element);this._handles=$(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!self.resizing){if(this.className)var axis=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);self.axis=axis&&axis[1]?axis[1]:"se"}});if(o.autoHide){this._handles.hide();$(this.element).addClass("ui-resizable-autohide").hover(function(){$(this).removeClass("ui-resizable-autohide");self._handles.show()},function(){if(!self.resizing){$(this).addClass("ui-resizable-autohide");self._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var _destroy=function(exp){$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){_destroy(this.element);var wrapper=this.element;wrapper.after(this.originalElement.css({position:wrapper.css("position"),width:wrapper.outerWidth(),height:wrapper.outerHeight(),top:wrapper.css("top"),left:wrapper.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);_destroy(this.originalElement);return this},_mouseCapture:function(event){var handle=false;for(var i in this.handles){if($(this.handles[i])[0]==event.target){handle=true}}return!this.options.disabled&&handle},_mouseStart:function(event){var o=this.options,iniPos=this.element.position(),el=this.element;this.resizing=true;this.documentScroll={top:$(document).scrollTop(),left:$(document).scrollLeft()};if(el.is(".ui-draggable")||/absolute/.test(el.css("position"))){el.css({position:"absolute",top:iniPos.top,left:iniPos.left})}if($.browser.opera&&/relative/.test(el.css("position")))el.css({position:"relative",top:"auto",left:"auto"});this._renderProxy();var curleft=num(this.helper.css("left")),curtop=num(this.helper.css("top"));if(o.containment){curleft+=$(o.containment).scrollLeft()||0;curtop+=$(o.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:curleft,top:curtop};this.size=this._helper?{width:el.outerWidth(),height:el.outerHeight()}:{width:el.width(),height:el.height()};this.originalSize=this._helper?{width:el.outerWidth(),height:el.outerHeight()}:{width:el.width(),height:el.height()};this.originalPosition={left:curleft,top:curtop};this.sizeDiff={width:el.outerWidth()-el.width(),height:el.outerHeight()-el.height()};this.originalMousePosition={left:event.pageX,top:event.pageY};this.aspectRatio=typeof o.aspectRatio=="number"?o.aspectRatio:this.originalSize.width/this.originalSize.height||1;var cursor=$(".ui-resizable-"+this.axis).css("cursor");$("body").css("cursor",cursor=="auto"?this.axis+"-resize":cursor);el.addClass("ui-resizable-resizing");this._propagate("start",event);return true},_mouseDrag:function(event){var el=this.helper,o=this.options,props={},self=this,smp=this.originalMousePosition,a=this.axis;var dx=event.pageX-smp.left||0,dy=event.pageY-smp.top||0;var trigger=this._change[a];if(!trigger)return false;var data=trigger.apply(this,[event,dx,dy]),ie6=$.browser.msie&&$.browser.version<7,csdif=this.sizeDiff;if(this._aspectRatio||event.shiftKey)data=this._updateRatio(data,event);data=this._respectSize(data,event);this._propagate("resize",event);el.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length)this._proportionallyResize();this._updateCache(data);this._trigger("resize",event,this.ui());return false},_mouseStop:function(event){this.resizing=false;var o=this.options,self=this;if(this._helper){var pr=this._proportionallyResizeElements,ista=pr.length&&/textarea/i.test(pr[0].nodeName),soffseth=ista&&$.ui.hasScroll(pr[0],"left")?0:self.sizeDiff.height,soffsetw=ista?0:self.sizeDiff.width;var s={width:self.helper.width()-soffsetw,height:self.helper.height()-soffseth},left=parseInt(self.element.css("left"),10)+(self.position.left-self.originalPosition.left)||null,top=parseInt(self.element.css("top"),10)+(self.position.top-self.originalPosition.top)||null;if(!o.animate)this.element.css($.extend(s,{top:top,left:left}));self.helper.height(self.size.height);self.helper.width(self.size.width);if(this._helper&&!o.animate)this._proportionallyResize()}$("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",event);if(this._helper)this.helper.remove();return false},_updateCache:function(data){var o=this.options;this.offset=this.helper.offset();if(isNumber(data.left))this.position.left=data.left;if(isNumber(data.top))this.position.top=data.top;if(isNumber(data.height))this.size.height=data.height;if(isNumber(data.width))this.size.width=data.width},_updateRatio:function(data,event){var o=this.options,cpos=this.position,csize=this.size,a=this.axis;if(data.height)data.width=csize.height*this.aspectRatio;else if(data.width)data.height=csize.width/this.aspectRatio;if(a=="sw"){data.left=cpos.left+(csize.width-data.width);data.top=null}if(a=="nw"){data.top=cpos.top+(csize.height-data.height);data.left=cpos.left+(csize.width-data.width)}return data},_respectSize:function(data,event){var el=this.helper,o=this.options,pRatio=this._aspectRatio||event.shiftKey,a=this.axis,ismaxw=isNumber(data.width)&&o.maxWidth&&o.maxWidth<data.width,ismaxh=isNumber(data.height)&&o.maxHeight&&o.maxHeight<data.height,isminw=isNumber(data.width)&&o.minWidth&&o.minWidth>data.width,isminh=isNumber(data.height)&&o.minHeight&&o.minHeight>data.height;if(isminw)data.width=o.minWidth;if(isminh)data.height=o.minHeight;if(ismaxw)data.width=o.maxWidth;if(ismaxh)data.height=o.maxHeight;var dw=this.originalPosition.left+this.originalSize.width,dh=this.position.top+this.size.height;var cw=/sw|nw|w/.test(a),ch=/nw|ne|n/.test(a);if(isminw&&cw)data.left=dw-o.minWidth;if(ismaxw&&cw)data.left=dw-o.maxWidth;if(isminh&&ch)data.top=dh-o.minHeight;if(ismaxh&&ch)data.top=dh-o.maxHeight;var isNotwh=!data.width&&!data.height;if(isNotwh&&!data.left&&data.top)data.top=null;else if(isNotwh&&!data.top&&data.left)data.left=null;return data},_proportionallyResize:function(){var o=this.options;if(!this._proportionallyResizeElements.length)return;var element=this.helper||this.element;for(var i=0;i<this._proportionallyResizeElements.length;i++){var prel=this._proportionallyResizeElements[i];if(!this.borderDif){var b=[prel.css("borderTopWidth"),prel.css("borderRightWidth"),prel.css("borderBottomWidth"),prel.css("borderLeftWidth")],p=[prel.css("paddingTop"),prel.css("paddingRight"),prel.css("paddingBottom"),prel.css("paddingLeft")];this.borderDif=$.map(b,function(v,i){var border=parseInt(v,10)||0,padding=parseInt(p[i],10)||0;return border+padding})}if($.browser.msie&&!!($(element).is(":hidden")||$(element).parents(":hidden").length))continue;prel.css({height:element.height()-this.borderDif[0]-this.borderDif[2]||0,width:element.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var el=this.element,o=this.options;this.elementOffset=el.offset();if(this._helper){this.helper=this.helper||$('<div style="overflow:hidden;"></div>');var ie6=$.browser.msie&&$.browser.version<7,ie6offset=ie6?1:0,pxyoffset=ie6?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+pxyoffset,height:this.element.outerHeight()+pxyoffset,position:"absolute",left:this.elementOffset.left-ie6offset+"px",top:this.elementOffset.top-ie6offset+"px",zIndex:++o.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(event,dx,dy){return{width:this.originalSize.width+dx}},w:function(event,dx,dy){var o=this.options,cs=this.originalSize,sp=this.originalPosition;return{left:sp.left+dx,width:cs.width-dx}},n:function(event,dx,dy){var o=this.options,cs=this.originalSize,sp=this.originalPosition;return{top:sp.top+dy,height:cs.height-dy}},s:function(event,dx,dy){return{height:this.originalSize.height+dy}},se:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]))},sw:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]))},ne:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]))},nw:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]))}},_propagate:function(n,event){$.ui.plugin.call(this,n,[event,this.ui()]);n!="resize"&&this._trigger(n,event,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});$.extend($.ui.resizable,{version:"1.8.12"});$.ui.plugin.add("resizable","alsoResize",{start:function(event,ui){var self=$(this).data("resizable"),o=self.options;var _store=function(exp){$(exp).each(function(){var el=$(this);el.data("resizable-alsoresize",{width:parseInt(el.width(),10),height:parseInt(el.height(),10),left:parseInt(el.css("left"),10),top:parseInt(el.css("top"),10),position:el.css("position")})})};if(typeof o.alsoResize=="object"&&!o.alsoResize.parentNode){if(o.alsoResize.length){o.alsoResize=o.alsoResize[0];_store(o.alsoResize)}else{$.each(o.alsoResize,function(exp){_store(exp)})}}else{_store(o.alsoResize)}},resize:function(event,ui){var self=$(this).data("resizable"),o=self.options,os=self.originalSize,op=self.originalPosition;var delta={height:self.size.height-os.height||0,width:self.size.width-os.width||0,top:self.position.top-op.top||0,left:self.position.left-op.left||0},_alsoResize=function(exp,c){$(exp).each(function(){var el=$(this),start=$(this).data("resizable-alsoresize"),style={},css=c&&c.length?c:el.parents(ui.originalElement[0]).length?["width","height"]:["width","height","top","left"];$.each(css,function(i,prop){var sum=(start[prop]||0)+(delta[prop]||0);if(sum&&sum>=0)style[prop]=sum||null});if($.browser.opera&&/relative/.test(el.css("position"))){self._revertToRelativePosition=true;el.css({position:"absolute",top:"auto",left:"auto"})}el.css(style)})};if(typeof o.alsoResize=="object"&&!o.alsoResize.nodeType){$.each(o.alsoResize,function(exp,c){_alsoResize(exp,c)})}else{_alsoResize(o.alsoResize)}},stop:function(event,ui){var self=$(this).data("resizable"),o=self.options;var _reset=function(exp){$(exp).each(function(){var el=$(this);el.css({position:el.data("resizable-alsoresize").position})})};if(self._revertToRelativePosition){self._revertToRelativePosition=false;if(typeof o.alsoResize=="object"&&!o.alsoResize.nodeType){$.each(o.alsoResize,function(exp){_reset(exp)})}else{_reset(o.alsoResize)}}$(this).removeData("resizable-alsoresize")}});$.ui.plugin.add("resizable","animate",{stop:function(event,ui){var self=$(this).data("resizable"),o=self.options;var pr=self._proportionallyResizeElements,ista=pr.length&&/textarea/i.test(pr[0].nodeName),soffseth=ista&&$.ui.hasScroll(pr[0],"left")?0:self.sizeDiff.height,soffsetw=ista?0:self.sizeDiff.width;var style={width:self.size.width-soffsetw,height:self.size.height-soffseth},left=parseInt(self.element.css("left"),10)+(self.position.left-self.originalPosition.left)||null,top=parseInt(self.element.css("top"),10)+(self.position.top-self.originalPosition.top)||null;self.element.animate($.extend(style,top&&left?{top:top,left:left}:{}),{duration:o.animateDuration,easing:o.animateEasing,step:function(){var data={width:parseInt(self.element.css("width"),10),height:parseInt(self.element.css("height"),10),top:parseInt(self.element.css("top"),10),left:parseInt(self.element.css("left"),10)};if(pr&&pr.length)$(pr[0]).css({width:data.width,height:data.height});self._updateCache(data);self._propagate("resize",event)}})}});$.ui.plugin.add("resizable","containment",{start:function(event,ui){var self=$(this).data("resizable"),o=self.options,el=self.element;var oc=o.containment,ce=oc instanceof $?oc.get(0):/parent/.test(oc)?el.parent().get(0):oc;if(!ce)return;self.containerElement=$(ce);if(/document/.test(oc)||oc==document){self.containerOffset={left:0,top:0};self.containerPosition={left:0,top:0};self.parentData={element:$(document),left:0,top:0,width:$(document).width(),height:$(document).height()||document.body.parentNode.scrollHeight}}else{var element=$(ce),p=[];$(["Top","Right","Left","Bottom"]).each(function(i,name){p[i]=num(element.css("padding"+name))});self.containerOffset=element.offset();self.containerPosition=element.position();self.containerSize={height:element.innerHeight()-p[3],width:element.innerWidth()-p[1]};var co=self.containerOffset,ch=self.containerSize.height,cw=self.containerSize.width,width=$.ui.hasScroll(ce,"left")?ce.scrollWidth:cw,height=$.ui.hasScroll(ce)?ce.scrollHeight:ch;self.parentData={element:ce,left:co.left,top:co.top,width:width,height:height}}},resize:function(event,ui){var self=$(this).data("resizable"),o=self.options,ps=self.containerSize,co=self.containerOffset,cs=self.size,cp=self.position,pRatio=self._aspectRatio||event.shiftKey,cop={top:0,left:0},ce=self.containerElement;if(ce[0]!=document&&/static/.test(ce.css("position")))cop=co;if(cp.left<(self._helper?co.left:0)){self.size.width=self.size.width+(self._helper?self.position.left-co.left:self.position.left-cop.left);if(pRatio)self.size.height=self.size.width/o.aspectRatio;self.position.left=o.helper?co.left:0}if(cp.top<(self._helper?co.top:0)){self.size.height=self.size.height+(self._helper?self.position.top-co.top:self.position.top);if(pRatio)self.size.width=self.size.height*o.aspectRatio;self.position.top=self._helper?co.top:0}self.offset.left=self.parentData.left+self.position.left;self.offset.top=self.parentData.top+self.position.top;var woset=Math.abs((self._helper?self.offset.left-cop.left:self.offset.left-cop.left)+self.sizeDiff.width),hoset=Math.abs((self._helper?self.offset.top-cop.top:self.offset.top-co.top)+self.sizeDiff.height);var isParent=self.containerElement.get(0)==self.element.parent().get(0),isOffsetRelative=/relative|absolute/.test(self.containerElement.css("position"));if(isParent&&isOffsetRelative)woset-=self.parentData.left;if(woset+self.size.width>=self.parentData.width){self.size.width=self.parentData.width-woset;if(pRatio)self.size.height=self.size.width/self.aspectRatio}if(hoset+self.size.height>=self.parentData.height){self.size.height=self.parentData.height-hoset;if(pRatio)self.size.width=self.size.height*self.aspectRatio}},stop:function(event,ui){var self=$(this).data("resizable"),o=self.options,cp=self.position,co=self.containerOffset,cop=self.containerPosition,ce=self.containerElement;var helper=$(self.helper),ho=helper.offset(),w=helper.outerWidth()-self.sizeDiff.width,h=helper.outerHeight()-self.sizeDiff.height;if(self._helper&&!o.animate&&/relative/.test(ce.css("position")))$(this).css({left:ho.left-cop.left-co.left,width:w,height:h});if(self._helper&&!o.animate&&/static/.test(ce.css("position")))$(this).css({left:ho.left-cop.left-co.left,width:w,height:h})}});$.ui.plugin.add("resizable","ghost",{start:function(event,ui){var self=$(this).data("resizable"),o=self.options,cs=self.size;self.ghost=self.originalElement.clone();self.ghost.css({opacity:.25,display:"block",position:"relative",height:cs.height,width:cs.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof o.ghost=="string"?o.ghost:"");self.ghost.appendTo(self.helper)},resize:function(event,ui){var self=$(this).data("resizable"),o=self.options;if(self.ghost)self.ghost.css({position:"relative",height:self.size.height,width:self.size.width})},stop:function(event,ui){var self=$(this).data("resizable"),o=self.options;if(self.ghost&&self.helper)self.helper.get(0).removeChild(self.ghost.get(0))}});$.ui.plugin.add("resizable","grid",{resize:function(event,ui){var self=$(this).data("resizable"),o=self.options,cs=self.size,os=self.originalSize,op=self.originalPosition,a=self.axis,ratio=o._aspectRatio||event.shiftKey;o.grid=typeof o.grid=="number"?[o.grid,o.grid]:o.grid;var ox=Math.round((cs.width-os.width)/(o.grid[0]||1))*(o.grid[0]||1),oy=Math.round((cs.height-os.height)/(o.grid[1]||1))*(o.grid[1]||1);if(/^(se|s|e)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy}else if(/^(ne)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.top=op.top-oy}else if(/^(sw)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.left=op.left-ox}else{self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.top=op.top-oy;self.position.left=op.left-ox}}});var num=function(v){return parseInt(v,10)||0};var isNumber=function(value){return!isNaN(parseInt(value,10))}})(jQuery);(function($,undefined){$.widget("ui.selectable",$.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var self=this;this.element.addClass("ui-selectable");this.dragged=false;var selectees;this.refresh=function(){selectees=$(self.options.filter,self.element[0]);selectees.each(function(){var $this=$(this);var pos=$this.offset();$.data(this,"selectable-item",{element:this,$element:$this,left:pos.left,top:pos.top,right:pos.left+$this.outerWidth(),bottom:pos.top+$this.outerHeight(),startselected:false,selected:$this.hasClass("ui-selected"),selecting:$this.hasClass("ui-selecting"),unselecting:$this.hasClass("ui-unselecting")})})};this.refresh();this.selectees=selectees.addClass("ui-selectee");this._mouseInit();this.helper=$("<div class='ui-selectable-helper'></div>")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(event){var self=this;this.opos=[event.pageX,event.pageY];if(this.options.disabled)return;var options=this.options;this.selectees=$(options.filter,this.element[0]);this._trigger("start",event);$(options.appendTo).append(this.helper);this.helper.css({left:event.clientX,top:event.clientY,width:0,height:0});if(options.autoRefresh){this.refresh()}this.selectees.filter(".ui-selected").each(function(){var selectee=$.data(this,"selectable-item");selectee.startselected=true;if(!event.metaKey){selectee.$element.removeClass("ui-selected");selectee.selected=false;selectee.$element.addClass("ui-unselecting");selectee.unselecting=true;self._trigger("unselecting",event,{unselecting:selectee.element
})}});$(event.target).parents().andSelf().each(function(){var selectee=$.data(this,"selectable-item");if(selectee){var doSelect=!event.metaKey||!selectee.$element.hasClass("ui-selected");selectee.$element.removeClass(doSelect?"ui-unselecting":"ui-selected").addClass(doSelect?"ui-selecting":"ui-unselecting");selectee.unselecting=!doSelect;selectee.selecting=doSelect;selectee.selected=doSelect;if(doSelect){self._trigger("selecting",event,{selecting:selectee.element})}else{self._trigger("unselecting",event,{unselecting:selectee.element})}return false}})},_mouseDrag:function(event){var self=this;this.dragged=true;if(this.options.disabled)return;var options=this.options;var x1=this.opos[0],y1=this.opos[1],x2=event.pageX,y2=event.pageY;if(x1>x2){var tmp=x2;x2=x1;x1=tmp}if(y1>y2){var tmp=y2;y2=y1;y1=tmp}this.helper.css({left:x1,top:y1,width:x2-x1,height:y2-y1});this.selectees.each(function(){var selectee=$.data(this,"selectable-item");if(!selectee||selectee.element==self.element[0])return;var hit=false;if(options.tolerance=="touch"){hit=!(selectee.left>x2||selectee.right<x1||selectee.top>y2||selectee.bottom<y1)}else if(options.tolerance=="fit"){hit=selectee.left>x1&&selectee.right<x2&&selectee.top>y1&&selectee.bottom<y2}if(hit){if(selectee.selected){selectee.$element.removeClass("ui-selected");selectee.selected=false}if(selectee.unselecting){selectee.$element.removeClass("ui-unselecting");selectee.unselecting=false}if(!selectee.selecting){selectee.$element.addClass("ui-selecting");selectee.selecting=true;self._trigger("selecting",event,{selecting:selectee.element})}}else{if(selectee.selecting){if(event.metaKey&&selectee.startselected){selectee.$element.removeClass("ui-selecting");selectee.selecting=false;selectee.$element.addClass("ui-selected");selectee.selected=true}else{selectee.$element.removeClass("ui-selecting");selectee.selecting=false;if(selectee.startselected){selectee.$element.addClass("ui-unselecting");selectee.unselecting=true}self._trigger("unselecting",event,{unselecting:selectee.element})}}if(selectee.selected){if(!event.metaKey&&!selectee.startselected){selectee.$element.removeClass("ui-selected");selectee.selected=false;selectee.$element.addClass("ui-unselecting");selectee.unselecting=true;self._trigger("unselecting",event,{unselecting:selectee.element})}}}});return false},_mouseStop:function(event){var self=this;this.dragged=false;var options=this.options;$(".ui-unselecting",this.element[0]).each(function(){var selectee=$.data(this,"selectable-item");selectee.$element.removeClass("ui-unselecting");selectee.unselecting=false;selectee.startselected=false;self._trigger("unselected",event,{unselected:selectee.element})});$(".ui-selecting",this.element[0]).each(function(){var selectee=$.data(this,"selectable-item");selectee.$element.removeClass("ui-selecting").addClass("ui-selected");selectee.selecting=false;selectee.selected=true;selectee.startselected=true;self._trigger("selected",event,{selected:selectee.element})});this._trigger("stop",event);this.helper.remove();return false}});$.extend($.ui.selectable,{version:"1.8.12"})})(jQuery);(function($,undefined){$.widget("ui.sortable",$.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3},_create:function(){var o=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var i=this.items.length-1;i>=0;i--)this.items[i].item.removeData("sortable-item");return this},_setOption:function(key,value){if(key==="disabled"){this.options[key]=value;this.widget()[value?"addClass":"removeClass"]("ui-sortable-disabled")}else{$.Widget.prototype._setOption.apply(this,arguments)}},_mouseCapture:function(event,overrideHandle){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(event);var currentItem=null,self=this,nodes=$(event.target).parents().each(function(){if($.data(this,"sortable-item")==self){currentItem=$(this);return false}});if($.data(event.target,"sortable-item")==self)currentItem=$(event.target);if(!currentItem)return false;if(this.options.handle&&!overrideHandle){var validHandle=false;$(this.options.handle,currentItem).find("*").andSelf().each(function(){if(this==event.target)validHandle=true});if(!validHandle)return false}this.currentItem=currentItem;this._removeCurrentsFromItems();return true},_mouseStart:function(event,overrideHandle,noActivation){var o=this.options,self=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(event);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(o.containment)this._setContainment();if(o.cursor){if($("body").css("cursor"))this._storedCursor=$("body").css("cursor");$("body").css("cursor",o.cursor)}if(o.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",o.opacity)}if(o.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",o.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start",event,this._uiHash());if(!this._preserveHelperProportions)this._cacheHelperProportions();if(!noActivation){for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("activate",event,self._uiHash(this))}}if($.ui.ddmanager)$.ui.ddmanager.current=this;if($.ui.ddmanager&&!o.dropBehaviour)$.ui.ddmanager.prepareOffsets(this,event);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(event);return true},_mouseDrag:function(event){this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var o=this.options,scrolled=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-event.pageY<o.scrollSensitivity)this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop+o.scrollSpeed;else if(event.pageY-this.overflowOffset.top<o.scrollSensitivity)this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop-o.scrollSpeed;if(this.overflowOffset.left+this.scrollParent[0].offsetWidth-event.pageX<o.scrollSensitivity)this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft+o.scrollSpeed;else if(event.pageX-this.overflowOffset.left<o.scrollSensitivity)this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft-o.scrollSpeed}else{if(event.pageY-$(document).scrollTop()<o.scrollSensitivity)scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity)scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity)scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity)scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed)}if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour)$.ui.ddmanager.prepareOffsets(this,event)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for(var i=this.items.length-1;i>=0;i--){var item=this.items[i],itemElement=item.item[0],intersection=this._intersectsWithPointer(item);if(!intersection)continue;if(itemElement!=this.currentItem[0]&&this.placeholder[intersection==1?"next":"prev"]()[0]!=itemElement&&!$.ui.contains(this.placeholder[0],itemElement)&&(this.options.type=="semi-dynamic"?!$.ui.contains(this.element[0],itemElement):true)){this.direction=intersection==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(item)){this._rearrange(event,item)}else{break}this._trigger("change",event,this._uiHash());break}}this._contactContainers(event);if($.ui.ddmanager)$.ui.ddmanager.drag(this,event);this._trigger("sort",event,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(event,noPropagation){if(!event)return;if($.ui.ddmanager&&!this.options.dropBehaviour)$.ui.ddmanager.drop(this,event);if(this.options.revert){var self=this;var cur=self.placeholder.offset();self.reverting=true;$(this.helper).animate({left:cur.left-this.offset.parent.left-self.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:cur.top-this.offset.parent.top-self.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){self._clear(event)})}else{this._clear(event,noPropagation)}return false},cancel:function(){var self=this;if(this.dragging){this._mouseUp({target:null});if(this.options.helper=="original")this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");else this.currentItem.show();for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("deactivate",null,self._uiHash(this));if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",null,self._uiHash(this));this.containers[i].containerCache.over=0}}}if(this.placeholder){if(this.placeholder[0].parentNode)this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode)this.helper.remove();$.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){$(this.domPosition.prev).after(this.currentItem)}else{$(this.domPosition.parent).prepend(this.currentItem)}}return this},serialize:function(o){var items=this._getItemsAsjQuery(o&&o.connected);var str=[];o=o||{};$(items).each(function(){var res=($(o.item||this).attr(o.attribute||"id")||"").match(o.expression||/(.+)[-=_](.+)/);if(res)str.push((o.key||res[1]+"[]")+"="+(o.key&&o.expression?res[1]:res[2]))});if(!str.length&&o.key){str.push(o.key+"=")}return str.join("&")},toArray:function(o){var items=this._getItemsAsjQuery(o&&o.connected);var ret=[];o=o||{};items.each(function(){ret.push($(o.item||this).attr(o.attribute||"id")||"")});return ret},_intersectsWith:function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height;var l=item.left,r=l+item.width,t=item.top,b=t+item.height;var dyClick=this.offset.click.top,dxClick=this.offset.click.left;var isOverElement=y1+dyClick>t&&y1+dyClick<b&&x1+dxClick>l&&x1+dxClick<r;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>item[this.floating?"width":"height"]){return isOverElement}else{return l<x1+this.helperProportions.width/2&&x2-this.helperProportions.width/2<r&&t<y1+this.helperProportions.height/2&&y2-this.helperProportions.height/2<b}},_intersectsWithPointer:function(item){var isOverElementHeight=$.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,item.top,item.height),isOverElementWidth=$.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,item.left,item.width),isOverElement=isOverElementHeight&&isOverElementWidth,verticalDirection=this._getDragVerticalDirection(),horizontalDirection=this._getDragHorizontalDirection();if(!isOverElement)return false;return this.floating?horizontalDirection&&horizontalDirection=="right"||verticalDirection=="down"?2:1:verticalDirection&&(verticalDirection=="down"?2:1)},_intersectsWithSides:function(item){var isOverBottomHalf=$.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,item.top+item.height/2,item.height),isOverRightHalf=$.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,item.left+item.width/2,item.width),verticalDirection=this._getDragVerticalDirection(),horizontalDirection=this._getDragHorizontalDirection();if(this.floating&&horizontalDirection){return horizontalDirection=="right"&&isOverRightHalf||horizontalDirection=="left"&&!isOverRightHalf}else{return verticalDirection&&(verticalDirection=="down"&&isOverBottomHalf||verticalDirection=="up"&&!isOverBottomHalf)}},_getDragVerticalDirection:function(){var delta=this.positionAbs.top-this.lastPositionAbs.top;return delta!=0&&(delta>0?"down":"up")},_getDragHorizontalDirection:function(){var delta=this.positionAbs.left-this.lastPositionAbs.left;return delta!=0&&(delta>0?"right":"left")},refresh:function(event){this._refreshItems(event);this.refreshPositions();return this},_connectWith:function(){var options=this.options;return options.connectWith.constructor==String?[options.connectWith]:options.connectWith},_getItemsAsjQuery:function(connected){var self=this;var items=[];var queries=[];var connectWith=this._connectWith();if(connectWith&&connected){for(var i=connectWith.length-1;i>=0;i--){var cur=$(connectWith[i]);for(var j=cur.length-1;j>=0;j--){var inst=$.data(cur[j],"sortable");if(inst&&inst!=this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element):$(inst.options.items,inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),inst])}}}}queries.push([$.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):$(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(var i=queries.length-1;i>=0;i--){queries[i][0].each(function(){items.push(this)})}return $(items)},_removeCurrentsFromItems:function(){var list=this.currentItem.find(":data(sortable-item)");for(var i=0;i<this.items.length;i++){for(var j=0;j<list.length;j++){if(list[j]==this.items[i].item[0])this.items.splice(i,1)}}},_refreshItems:function(event){this.items=[];this.containers=[this];var items=this.items;var self=this;var queries=[[$.isFunction(this.options.items)?this.options.items.call(this.element[0],event,{item:this.currentItem}):$(this.options.items,this.element),this]];var connectWith=this._connectWith();if(connectWith){for(var i=connectWith.length-1;i>=0;i--){var cur=$(connectWith[i]);for(var j=cur.length-1;j>=0;j--){var inst=$.data(cur[j],"sortable");if(inst&&inst!=this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element[0],event,{item:this.currentItem}):$(inst.options.items,inst.element),inst]);this.containers.push(inst)}}}}for(var i=queries.length-1;i>=0;i--){var targetData=queries[i][1];var _queries=queries[i][0];for(var j=0,queriesLength=_queries.length;j<queriesLength;j++){var item=$(_queries[j]);item.data("sortable-item",targetData);items.push({item:item,instance:targetData,width:0,height:0,left:0,top:0})}}},refreshPositions:function(fast){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()}for(var i=this.items.length-1;i>=0;i--){var item=this.items[i];if(item.instance!=this.currentContainer&&this.currentContainer&&item.item[0]!=this.currentItem[0])continue;var t=this.options.toleranceElement?$(this.options.toleranceElement,item.item):item.item;if(!fast){item.width=t.outerWidth();item.height=t.outerHeight()}var p=t.offset();item.left=p.left;item.top=p.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var i=this.containers.length-1;i>=0;i--){var p=this.containers[i].element.offset();this.containers[i].containerCache.left=p.left;this.containers[i].containerCache.top=p.top;this.containers[i].containerCache.width=this.containers[i].element.outerWidth();this.containers[i].containerCache.height=this.containers[i].element.outerHeight()}}return this},_createPlaceholder:function(that){var self=that||this,o=self.options;if(!o.placeholder||o.placeholder.constructor==String){var className=o.placeholder;o.placeholder={element:function(){var el=$(document.createElement(self.currentItem[0].nodeName)).addClass(className||self.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!className)el.style.visibility="hidden";return el},update:function(container,p){if(className&&!o.forcePlaceholderSize)return;if(!p.height()){p.height(self.currentItem.innerHeight()-parseInt(self.currentItem.css("paddingTop")||0,10)-parseInt(self.currentItem.css("paddingBottom")||0,10))}if(!p.width()){p.width(self.currentItem.innerWidth()-parseInt(self.currentItem.css("paddingLeft")||0,10)-parseInt(self.currentItem.css("paddingRight")||0,10))}}}}self.placeholder=$(o.placeholder.element.call(self.element,self.currentItem));self.currentItem.after(self.placeholder);o.placeholder.update(self,self.placeholder)},_contactContainers:function(event){var innermostContainer=null,innermostIndex=null;for(var i=this.containers.length-1;i>=0;i--){if($.ui.contains(this.currentItem[0],this.containers[i].element[0]))continue;if(this._intersectsWith(this.containers[i].containerCache)){if(innermostContainer&&$.ui.contains(this.containers[i].element[0],innermostContainer.element[0]))continue;innermostContainer=this.containers[i];innermostIndex=i}else{if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",event,this._uiHash(this));this.containers[i].containerCache.over=0}}}if(!innermostContainer)return;if(this.containers.length===1){this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1}else if(this.currentContainer!=this.containers[innermostIndex]){var dist=1e4;var itemWithLeastDistance=null;var base=this.positionAbs[this.containers[innermostIndex].floating?"left":"top"];for(var j=this.items.length-1;j>=0;j--){if(!$.ui.contains(this.containers[innermostIndex].element[0],this.items[j].item[0]))continue;var cur=this.items[j][this.containers[innermostIndex].floating?"left":"top"];if(Math.abs(cur-base)<dist){dist=Math.abs(cur-base);itemWithLeastDistance=this.items[j]}}if(!itemWithLeastDistance&&!this.options.dropOnEmpty)return;this.currentContainer=this.containers[innermostIndex];itemWithLeastDistance?this._rearrange(event,itemWithLeastDistance,null,true):this._rearrange(event,null,this.containers[innermostIndex].element,true);this._trigger("change",event,this._uiHash());this.containers[innermostIndex]._trigger("change",event,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1}},_createHelper:function(event){var o=this.options;var helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event,this.currentItem])):o.helper=="clone"?this.currentItem.clone():this.currentItem;if(!helper.parents("body").length)$(o.appendTo!="parent"?o.appendTo:this.currentItem[0].parentNode)[0].appendChild(helper[0]);if(helper[0]==this.currentItem[0])this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")};if(helper[0].style.width==""||o.forceHelperSize)helper.width(this.currentItem.width());if(helper[0].style.height==""||o.forceHelperSize)helper.height(this.currentItem.height());return helper},_adjustOffsetFromHelper:function(obj){if(typeof obj=="string"){obj=obj.split(" ")}if($.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0}}if("left"in obj){this.offset.click.left=obj.left+this.margins.left}if("right"in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left}if("top"in obj){this.offset.click.top=obj.top+this.margins.top}if("bottom"in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&$.browser.msie)po={top:0,left:0};return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var p=this.currentItem.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var o=this.options;if(o.containment=="parent")o.containment=this.helper[0].parentNode;if(o.containment=="document"||o.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,$(o.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,($(o.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(o.containment)){var ce=$(o.containment)[0];var co=$(o.containment).offset();var over=$(ce).css("overflow")!="hidden";this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)+(parseInt($(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)+(parseInt($(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-(parseInt($(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-(parseInt($(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(d,pos){if(!pos)pos=this.position;var mod=d=="absolute"?1:-1;var o=this.options,scroll=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=/(html|body)/i.test(scroll[0].tagName);return{top:pos.top+this.offset.relative.top*mod+this.offset.parent.top*mod-($.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():scrollIsRootNode?0:scroll.scrollTop())*mod),left:pos.left+this.offset.relative.left*mod+this.offset.parent.left*mod-($.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod)}},_generatePosition:function(event){var o=this.options,scroll=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=/(html|body)/i.test(scroll[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var pageX=event.pageX;var pageY=event.pageY;if(this.originalPosition){if(this.containment){if(event.pageX-this.offset.click.left<this.containment[0])pageX=this.containment[0]+this.offset.click.left;if(event.pageY-this.offset.click.top<this.containment[1])pageY=this.containment[1]+this.offset.click.top;if(event.pageX-this.offset.click.left>this.containment[2])pageX=this.containment[2]+this.offset.click.left;if(event.pageY-this.offset.click.top>this.containment[3])pageY=this.containment[3]+this.offset.click.top}if(o.grid){var top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?!(top-this.offset.click.top<this.containment[1]||top-this.offset.click.top>this.containment[3])?top:!(top-this.offset.click.top<this.containment[1])?top-o.grid[1]:top+o.grid[1]:top;var left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0];pageX=this.containment?!(left-this.offset.click.left<this.containment[0]||left-this.offset.click.left>this.containment[2])?left:!(left-this.offset.click.left<this.containment[0])?left-o.grid[0]:left+o.grid[0]:left}}return{top:pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+($.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():scrollIsRootNode?0:scroll.scrollTop()),left:pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+($.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())}},_rearrange:function(event,i,a,hardRefresh){a?a[0].appendChild(this.placeholder[0]):i.item[0].parentNode.insertBefore(this.placeholder[0],this.direction=="down"?i.item[0]:i.item[0].nextSibling);this.counter=this.counter?++this.counter:1;var self=this,counter=this.counter;window.setTimeout(function(){if(counter==self.counter)self.refreshPositions(!hardRefresh)},0)},_clear:function(event,noPropagation){this.reverting=false;var delayedTriggers=[],self=this;if(!this._noFinalSort&&this.currentItem[0].parentNode)this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var i in this._storedCSS){if(this._storedCSS[i]=="auto"||this._storedCSS[i]=="static")this._storedCSS[i]=""}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}if(this.fromOutside&&!noPropagation)delayedTriggers.push(function(event){this._trigger("receive",event,this._uiHash(this.fromOutside))});if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!noPropagation)delayedTriggers.push(function(event){this._trigger("update",event,this._uiHash())});if(!$.ui.contains(this.element[0],this.currentItem[0])){if(!noPropagation)delayedTriggers.push(function(event){this._trigger("remove",event,this._uiHash())});for(var i=this.containers.length-1;i>=0;i--){if($.ui.contains(this.containers[i].element[0],this.currentItem[0])&&!noPropagation){delayedTriggers.push(function(c){return function(event){c._trigger("receive",event,this._uiHash(this))}}.call(this,this.containers[i]));delayedTriggers.push(function(c){return function(event){c._trigger("update",event,this._uiHash(this))}}.call(this,this.containers[i]))}}}for(var i=this.containers.length-1;i>=0;i--){if(!noPropagation)delayedTriggers.push(function(c){return function(event){c._trigger("deactivate",event,this._uiHash(this))}}.call(this,this.containers[i]));if(this.containers[i].containerCache.over){delayedTriggers.push(function(c){return function(event){c._trigger("out",event,this._uiHash(this))}}.call(this,this.containers[i]));this.containers[i].containerCache.over=0}}if(this._storedCursor)$("body").css("cursor",this._storedCursor);if(this._storedOpacity)this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!noPropagation){this._trigger("beforeStop",event,this._uiHash());for(var i=0;i<delayedTriggers.length;i++){delayedTriggers[i].call(this,event)}this._trigger("stop",event,this._uiHash())}return false}if(!noPropagation)this._trigger("beforeStop",event,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!=this.currentItem[0])this.helper.remove();this.helper=null;if(!noPropagation){for(var i=0;i<delayedTriggers.length;i++){delayedTriggers[i].call(this,event)}this._trigger("stop",event,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){if($.Widget.prototype._trigger.apply(this,arguments)===false){this.cancel()}},_uiHash:function(inst){var self=inst||this;return{helper:self.helper,placeholder:self.placeholder||$([]),position:self.position,originalPosition:self.originalPosition,offset:self.positionAbs,item:self.currentItem,sender:inst?inst.element:null}}});$.extend($.ui.sortable,{version:"1.8.12"})})(jQuery);jQuery.effects||function($,undefined){$.effects={};$.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","borderColor","color","outlineColor"],function(i,attr){$.fx.step[attr]=function(fx){if(!fx.colorInit){fx.start=getColor(fx.elem,attr);fx.end=getRGB(fx.end);fx.colorInit=true}fx.elem.style[attr]="rgb("+Math.max(Math.min(parseInt(fx.pos*(fx.end[0]-fx.start[0])+fx.start[0],10),255),0)+","+Math.max(Math.min(parseInt(fx.pos*(fx.end[1]-fx.start[1])+fx.start[1],10),255),0)+","+Math.max(Math.min(parseInt(fx.pos*(fx.end[2]-fx.start[2])+fx.start[2],10),255),0)+")"}});function getRGB(color){var result;if(color&&color.constructor==Array&&color.length==3)return color;if(result=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))return[parseInt(result[1],10),parseInt(result[2],10),parseInt(result[3],10)];if(result=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))return[parseFloat(result[1])*2.55,parseFloat(result[2])*2.55,parseFloat(result[3])*2.55];if(result=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))return[parseInt(result[1],16),parseInt(result[2],16),parseInt(result[3],16)];if(result=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))return[parseInt(result[1]+result[1],16),parseInt(result[2]+result[2],16),parseInt(result[3]+result[3],16)];if(result=/rgba\(0, 0, 0, 0\)/.exec(color))return colors["transparent"];return colors[$.trim(color).toLowerCase()]}function getColor(elem,attr){var color;do{color=$.curCSS(elem,attr);if(color!=""&&color!="transparent"||$.nodeName(elem,"body"))break;attr="backgroundColor"}while(elem=elem.parentNode);return getRGB(color)}var colors={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],
darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};var classAnimationActions=["add","remove","toggle"],shorthandStyles={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};function getElementStyles(){var style=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,newStyle={},key,camelCase;if(style&&style.length&&style[0]&&style[style[0]]){var len=style.length;while(len--){key=style[len];if(typeof style[key]=="string"){camelCase=key.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase()});newStyle[camelCase]=style[key]}}}else{for(key in style){if(typeof style[key]==="string"){newStyle[key]=style[key]}}}return newStyle}function filterStyles(styles){var name,value;for(name in styles){value=styles[name];if(value==null||$.isFunction(value)||name in shorthandStyles||/scrollbar/.test(name)||!/color/i.test(name)&&isNaN(parseFloat(value))){delete styles[name]}}return styles}function styleDifference(oldStyle,newStyle){var diff={_:0},name;for(name in newStyle){if(oldStyle[name]!=newStyle[name]){diff[name]=newStyle[name]}}return diff}$.effects.animateClass=function(value,duration,easing,callback){if($.isFunction(easing)){callback=easing;easing=null}return this.queue("fx",function(){var that=$(this),originalStyleAttr=that.attr("style")||" ",originalStyle=filterStyles(getElementStyles.call(this)),newStyle,className=that.attr("className");$.each(classAnimationActions,function(i,action){if(value[action]){that[action+"Class"](value[action])}});newStyle=filterStyles(getElementStyles.call(this));that.attr("className",className);that.animate(styleDifference(originalStyle,newStyle),duration,easing,function(){$.each(classAnimationActions,function(i,action){if(value[action]){that[action+"Class"](value[action])}});if(typeof that.attr("style")=="object"){that.attr("style").cssText="";that.attr("style").cssText=originalStyleAttr}else{that.attr("style",originalStyleAttr)}if(callback){callback.apply(this,arguments)}});var queue=$.queue(this),anim=queue.splice(queue.length-1,1)[0];queue.splice(1,0,anim);$.dequeue(this)})};$.fn.extend({_addClass:$.fn.addClass,addClass:function(classNames,speed,easing,callback){return speed?$.effects.animateClass.apply(this,[{add:classNames},speed,easing,callback]):this._addClass(classNames)},_removeClass:$.fn.removeClass,removeClass:function(classNames,speed,easing,callback){return speed?$.effects.animateClass.apply(this,[{remove:classNames},speed,easing,callback]):this._removeClass(classNames)},_toggleClass:$.fn.toggleClass,toggleClass:function(classNames,force,speed,easing,callback){if(typeof force=="boolean"||force===undefined){if(!speed){return this._toggleClass(classNames,force)}else{return $.effects.animateClass.apply(this,[force?{add:classNames}:{remove:classNames},speed,easing,callback])}}else{return $.effects.animateClass.apply(this,[{toggle:classNames},force,speed,easing])}},switchClass:function(remove,add,speed,easing,callback){return $.effects.animateClass.apply(this,[{add:add,remove:remove},speed,easing,callback])}});$.extend($.effects,{version:"1.8.12",save:function(element,set){for(var i=0;i<set.length;i++){if(set[i]!==null)element.data("ec.storage."+set[i],element[0].style[set[i]])}},restore:function(element,set){for(var i=0;i<set.length;i++){if(set[i]!==null)element.css(set[i],element.data("ec.storage."+set[i]))}},setMode:function(el,mode){if(mode=="toggle")mode=el.is(":hidden")?"show":"hide";return mode},getBaseline:function(origin,original){var y,x;switch(origin[0]){case"top":y=0;break;case"middle":y=.5;break;case"bottom":y=1;break;default:y=origin[0]/original.height}switch(origin[1]){case"left":x=0;break;case"center":x=.5;break;case"right":x=1;break;default:x=origin[1]/original.width}return{x:x,y:y}},createWrapper:function(element){if(element.parent().is(".ui-effects-wrapper")){return element.parent()}var props={width:element.outerWidth(true),height:element.outerHeight(true),"float":element.css("float")},wrapper=$("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0});element.wrap(wrapper);wrapper=element.parent();if(element.css("position")=="static"){wrapper.css({position:"relative"});element.css({position:"relative"})}else{$.extend(props,{position:element.css("position"),zIndex:element.css("z-index")});$.each(["top","left","bottom","right"],function(i,pos){props[pos]=element.css(pos);if(isNaN(parseInt(props[pos],10))){props[pos]="auto"}});element.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return wrapper.css(props).show()},removeWrapper:function(element){if(element.parent().is(".ui-effects-wrapper"))return element.parent().replaceWith(element);return element},setTransition:function(element,list,factor,value){value=value||{};$.each(list,function(i,x){unit=element.cssUnit(x);if(unit[0]>0)value[x]=unit[0]*factor+unit[1]});return value}});function _normalizeArguments(effect,options,speed,callback){if(typeof effect=="object"){callback=options;speed=null;options=effect;effect=options.effect}if($.isFunction(options)){callback=options;speed=null;options={}}if(typeof options=="number"||$.fx.speeds[options]){callback=speed;speed=options;options={}}if($.isFunction(speed)){callback=speed;speed=null}options=options||{};speed=speed||options.duration;speed=$.fx.off?0:typeof speed=="number"?speed:speed in $.fx.speeds?$.fx.speeds[speed]:$.fx.speeds._default;callback=callback||options.complete;return[effect,options,speed,callback]}function standardSpeed(speed){if(!speed||typeof speed==="number"||$.fx.speeds[speed]){return true}if(typeof speed==="string"&&!$.effects[speed]){return true}return false}$.fn.extend({effect:function(effect,options,speed,callback){var args=_normalizeArguments.apply(this,arguments),args2={options:args[1],duration:args[2],callback:args[3]},mode=args2.options.mode,effectMethod=$.effects[effect];if($.fx.off||!effectMethod){if(mode){return this[mode](args2.duration,args2.callback)}else{return this.each(function(){if(args2.callback){args2.callback.call(this)}})}}return effectMethod.call(this,args2)},_show:$.fn.show,show:function(speed){if(standardSpeed(speed)){return this._show.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args[1].mode="show";return this.effect.apply(this,args)}},_hide:$.fn.hide,hide:function(speed){if(standardSpeed(speed)){return this._hide.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args[1].mode="hide";return this.effect.apply(this,args)}},__toggle:$.fn.toggle,toggle:function(speed){if(standardSpeed(speed)||typeof speed==="boolean"||$.isFunction(speed)){return this.__toggle.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args[1].mode="toggle";return this.effect.apply(this,args)}},cssUnit:function(key){var style=this.css(key),val=[];$.each(["em","px","%","pt"],function(i,unit){if(style.indexOf(unit)>0)val=[parseFloat(style),unit]});return val}});$.easing.jswing=$.easing.swing;$.extend($.easing,{def:"easeOutQuad",swing:function(x,t,b,c,d){return $.easing[$.easing.def](x,t,b,c,d)},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*(--t*(t-2)-1)+b},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b},easeOutQuart:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b},easeInSine:function(x,t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b},easeInOutSine:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b},easeInExpo:function(x,t,b,c,d){return t==0?b:c*Math.pow(2,10*(t/d-1))+b},easeOutExpo:function(x,t,b,c,d){return t==d?b+c:c*(-Math.pow(2,-10*t/d)+1)+b},easeInOutExpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b},easeInCirc:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b},easeInBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b},easeOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=1.525)+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=1.525)+1)*t+s)+2)+b},easeInBounce:function(x,t,b,c,d){return c-$.easing.easeOutBounce(x,d-t,0,c,d)+b},easeOutBounce:function(x,t,b,c,d){if((t/=d)<1/2.75){return c*(7.5625*t*t)+b}else if(t<2/2.75){return c*(7.5625*(t-=1.5/2.75)*t+.75)+b}else if(t<2.5/2.75){return c*(7.5625*(t-=2.25/2.75)*t+.9375)+b}else{return c*(7.5625*(t-=2.625/2.75)*t+.984375)+b}},easeInOutBounce:function(x,t,b,c,d){if(t<d/2)return $.easing.easeInBounce(x,t*2,0,c,d)*.5+b;return $.easing.easeOutBounce(x,t*2-d,0,c,d)*.5+c*.5+b}})}(jQuery);(function($,undefined){$.effects.blind=function(o){return this.queue(function(){var el=$(this),props=["position","top","bottom","left","right"];var mode=$.effects.setMode(el,o.options.mode||"hide");var direction=o.options.direction||"vertical";$.effects.save(el,props);el.show();var wrapper=$.effects.createWrapper(el).css({overflow:"hidden"});var ref=direction=="vertical"?"height":"width";var distance=direction=="vertical"?wrapper.height():wrapper.width();if(mode=="show")wrapper.css(ref,0);var animation={};animation[ref]=mode=="show"?distance:0;wrapper.animate(animation,o.duration,o.options.easing,function(){if(mode=="hide")el.hide();$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(el[0],arguments);el.dequeue()})})}})(jQuery);(function($,undefined){$.effects.bounce=function(o){return this.queue(function(){var el=$(this),props=["position","top","bottom","left","right"];var mode=$.effects.setMode(el,o.options.mode||"effect");var direction=o.options.direction||"up";var distance=o.options.distance||20;var times=o.options.times||5;var speed=o.duration||250;if(/show|hide/.test(mode))props.push("opacity");$.effects.save(el,props);el.show();$.effects.createWrapper(el);var ref=direction=="up"||direction=="down"?"top":"left";var motion=direction=="up"||direction=="left"?"pos":"neg";var distance=o.options.distance||(ref=="top"?el.outerHeight({margin:true})/3:el.outerWidth({margin:true})/3);if(mode=="show")el.css("opacity",0).css(ref,motion=="pos"?-distance:distance);if(mode=="hide")distance=distance/(times*2);if(mode!="hide")times--;if(mode=="show"){var animation={opacity:1};animation[ref]=(motion=="pos"?"+=":"-=")+distance;el.animate(animation,speed/2,o.options.easing);distance=distance/2;times--}for(var i=0;i<times;i++){var animation1={},animation2={};animation1[ref]=(motion=="pos"?"-=":"+=")+distance;animation2[ref]=(motion=="pos"?"+=":"-=")+distance;el.animate(animation1,speed/2,o.options.easing).animate(animation2,speed/2,o.options.easing);distance=mode=="hide"?distance*2:distance/2}if(mode=="hide"){var animation={opacity:0};animation[ref]=(motion=="pos"?"-=":"+=")+distance;el.animate(animation,speed/2,o.options.easing,function(){el.hide();$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(this,arguments)})}else{var animation1={},animation2={};animation1[ref]=(motion=="pos"?"-=":"+=")+distance;animation2[ref]=(motion=="pos"?"+=":"-=")+distance;el.animate(animation1,speed/2,o.options.easing).animate(animation2,speed/2,o.options.easing,function(){$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(this,arguments)})}el.queue("fx",function(){el.dequeue()});el.dequeue()})}})(jQuery);(function($,undefined){$.effects.clip=function(o){return this.queue(function(){var el=$(this),props=["position","top","bottom","left","right","height","width"];var mode=$.effects.setMode(el,o.options.mode||"hide");var direction=o.options.direction||"vertical";$.effects.save(el,props);el.show();var wrapper=$.effects.createWrapper(el).css({overflow:"hidden"});var animate=el[0].tagName=="IMG"?wrapper:el;var ref={size:direction=="vertical"?"height":"width",position:direction=="vertical"?"top":"left"};var distance=direction=="vertical"?animate.height():animate.width();if(mode=="show"){animate.css(ref.size,0);animate.css(ref.position,distance/2)}var animation={};animation[ref.size]=mode=="show"?distance:0;animation[ref.position]=mode=="show"?0:distance/2;animate.animate(animation,{queue:false,duration:o.duration,easing:o.options.easing,complete:function(){if(mode=="hide")el.hide();$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(el[0],arguments);el.dequeue()}})})}})(jQuery);(function($,undefined){$.effects.drop=function(o){return this.queue(function(){var el=$(this),props=["position","top","bottom","left","right","opacity"];var mode=$.effects.setMode(el,o.options.mode||"hide");var direction=o.options.direction||"left";$.effects.save(el,props);el.show();$.effects.createWrapper(el);var ref=direction=="up"||direction=="down"?"top":"left";var motion=direction=="up"||direction=="left"?"pos":"neg";var distance=o.options.distance||(ref=="top"?el.outerHeight({margin:true})/2:el.outerWidth({margin:true})/2);if(mode=="show")el.css("opacity",0).css(ref,motion=="pos"?-distance:distance);var animation={opacity:mode=="show"?1:0};animation[ref]=(mode=="show"?motion=="pos"?"+=":"-=":motion=="pos"?"-=":"+=")+distance;el.animate(animation,{queue:false,duration:o.duration,easing:o.options.easing,complete:function(){if(mode=="hide")el.hide();$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(this,arguments);el.dequeue()}})})}})(jQuery);(function($,undefined){$.effects.explode=function(o){return this.queue(function(){var rows=o.options.pieces?Math.round(Math.sqrt(o.options.pieces)):3;var cells=o.options.pieces?Math.round(Math.sqrt(o.options.pieces)):3;o.options.mode=o.options.mode=="toggle"?$(this).is(":visible")?"hide":"show":o.options.mode;var el=$(this).show().css("visibility","hidden");var offset=el.offset();offset.top-=parseInt(el.css("marginTop"),10)||0;offset.left-=parseInt(el.css("marginLeft"),10)||0;var width=el.outerWidth(true);var height=el.outerHeight(true);for(var i=0;i<rows;i++){for(var j=0;j<cells;j++){el.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-j*(width/cells),top:-i*(height/rows)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:width/cells,height:height/rows,left:offset.left+j*(width/cells)+(o.options.mode=="show"?(j-Math.floor(cells/2))*(width/cells):0),top:offset.top+i*(height/rows)+(o.options.mode=="show"?(i-Math.floor(rows/2))*(height/rows):0),opacity:o.options.mode=="show"?0:1}).animate({left:offset.left+j*(width/cells)+(o.options.mode=="show"?0:(j-Math.floor(cells/2))*(width/cells)),top:offset.top+i*(height/rows)+(o.options.mode=="show"?0:(i-Math.floor(rows/2))*(height/rows)),opacity:o.options.mode=="show"?1:0},o.duration||500)}}setTimeout(function(){o.options.mode=="show"?el.css({visibility:"visible"}):el.css({visibility:"visible"}).hide();if(o.callback)o.callback.apply(el[0]);el.dequeue();$("div.ui-effects-explode").remove()},o.duration||500)})}})(jQuery);(function($,undefined){$.effects.fade=function(o){return this.queue(function(){var elem=$(this),mode=$.effects.setMode(elem,o.options.mode||"hide");elem.animate({opacity:mode},{queue:false,duration:o.duration,easing:o.options.easing,complete:function(){o.callback&&o.callback.apply(this,arguments);elem.dequeue()}})})}})(jQuery);(function($,undefined){$.effects.fold=function(o){return this.queue(function(){var el=$(this),props=["position","top","bottom","left","right"];var mode=$.effects.setMode(el,o.options.mode||"hide");var size=o.options.size||15;var horizFirst=!!o.options.horizFirst;var duration=o.duration?o.duration/2:$.fx.speeds._default/2;$.effects.save(el,props);el.show();var wrapper=$.effects.createWrapper(el).css({overflow:"hidden"});var widthFirst=mode=="show"!=horizFirst;var ref=widthFirst?["width","height"]:["height","width"];var distance=widthFirst?[wrapper.width(),wrapper.height()]:[wrapper.height(),wrapper.width()];var percent=/([0-9]+)%/.exec(size);if(percent)size=parseInt(percent[1],10)/100*distance[mode=="hide"?0:1];if(mode=="show")wrapper.css(horizFirst?{height:0,width:size}:{height:size,width:0});var animation1={},animation2={};animation1[ref[0]]=mode=="show"?distance[0]:size;animation2[ref[1]]=mode=="show"?distance[1]:0;wrapper.animate(animation1,duration,o.options.easing).animate(animation2,duration,o.options.easing,function(){if(mode=="hide")el.hide();$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(el[0],arguments);el.dequeue()})})}})(jQuery);(function($,undefined){$.effects.highlight=function(o){return this.queue(function(){var elem=$(this),props=["backgroundImage","backgroundColor","opacity"],mode=$.effects.setMode(elem,o.options.mode||"show"),animation={backgroundColor:elem.css("backgroundColor")};if(mode=="hide"){animation.opacity=0}$.effects.save(elem,props);elem.show().css({backgroundImage:"none",backgroundColor:o.options.color||"#ffff99"}).animate(animation,{queue:false,duration:o.duration,easing:o.options.easing,complete:function(){mode=="hide"&&elem.hide();$.effects.restore(elem,props);mode=="show"&&!$.support.opacity&&this.style.removeAttribute("filter");o.callback&&o.callback.apply(this,arguments);elem.dequeue()}})})}})(jQuery);(function($,undefined){$.effects.pulsate=function(o){return this.queue(function(){var elem=$(this),mode=$.effects.setMode(elem,o.options.mode||"show");times=(o.options.times||5)*2-1;duration=o.duration?o.duration/2:$.fx.speeds._default/2,isVisible=elem.is(":visible"),animateTo=0;if(!isVisible){elem.css("opacity",0).show();animateTo=1}if(mode=="hide"&&isVisible||mode=="show"&&!isVisible){times--}for(var i=0;i<times;i++){elem.animate({opacity:animateTo},duration,o.options.easing);animateTo=(animateTo+1)%2}elem.animate({opacity:animateTo},duration,o.options.easing,function(){if(animateTo==0){elem.hide()}o.callback&&o.callback.apply(this,arguments)});elem.queue("fx",function(){elem.dequeue()}).dequeue()})}})(jQuery);(function($,undefined){$.effects.puff=function(o){return this.queue(function(){var elem=$(this),mode=$.effects.setMode(elem,o.options.mode||"hide"),percent=parseInt(o.options.percent,10)||150,factor=percent/100,original={height:elem.height(),width:elem.width()};$.extend(o.options,{fade:true,mode:mode,percent:mode=="hide"?percent:100,from:mode=="hide"?original:{height:original.height*factor,width:original.width*factor}});elem.effect("scale",o.options,o.duration,o.callback);elem.dequeue()})};$.effects.scale=function(o){return this.queue(function(){var el=$(this);var options=$.extend(true,{},o.options);var mode=$.effects.setMode(el,o.options.mode||"effect");var percent=parseInt(o.options.percent,10)||(parseInt(o.options.percent,10)==0?0:mode=="hide"?0:100);var direction=o.options.direction||"both";var origin=o.options.origin;if(mode!="effect"){options.origin=origin||["middle","center"];options.restore=true}var original={height:el.height(),width:el.width()};el.from=o.options.from||(mode=="show"?{height:0,width:0}:original);var factor={y:direction!="horizontal"?percent/100:1,x:direction!="vertical"?percent/100:1};el.to={height:original.height*factor.y,width:original.width*factor.x};if(o.options.fade){if(mode=="show"){el.from.opacity=0;el.to.opacity=1}if(mode=="hide"){el.from.opacity=1;el.to.opacity=0}}options.from=el.from;options.to=el.to;options.mode=mode;el.effect("size",options,o.duration,o.callback);el.dequeue()})};$.effects.size=function(o){return this.queue(function(){var el=$(this),props=["position","top","bottom","left","right","width","height","overflow","opacity"];var props1=["position","top","bottom","left","right","overflow","opacity"];var props2=["width","height","overflow"];var cProps=["fontSize"];var vProps=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"];var hProps=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"];var mode=$.effects.setMode(el,o.options.mode||"effect");var restore=o.options.restore||false;var scale=o.options.scale||"both";var origin=o.options.origin;var original={height:el.height(),width:el.width()};el.from=o.options.from||original;el.to=o.options.to||original;if(origin){var baseline=$.effects.getBaseline(origin,original);el.from.top=(original.height-el.from.height)*baseline.y;el.from.left=(original.width-el.from.width)*baseline.x;el.to.top=(original.height-el.to.height)*baseline.y;el.to.left=(original.width-el.to.width)*baseline.x}var factor={from:{y:el.from.height/original.height,x:el.from.width/original.width},to:{y:el.to.height/original.height,x:el.to.width/original.width}};if(scale=="box"||scale=="both"){if(factor.from.y!=factor.to.y){props=props.concat(vProps);el.from=$.effects.setTransition(el,vProps,factor.from.y,el.from);el.to=$.effects.setTransition(el,vProps,factor.to.y,el.to)}if(factor.from.x!=factor.to.x){props=props.concat(hProps);el.from=$.effects.setTransition(el,hProps,factor.from.x,el.from);el.to=$.effects.setTransition(el,hProps,factor.to.x,el.to)}}if(scale=="content"||scale=="both"){if(factor.from.y!=factor.to.y){props=props.concat(cProps);el.from=$.effects.setTransition(el,cProps,factor.from.y,el.from);el.to=$.effects.setTransition(el,cProps,factor.to.y,el.to)}}$.effects.save(el,restore?props:props1);el.show();$.effects.createWrapper(el);el.css("overflow","hidden").css(el.from);if(scale=="content"||scale=="both"){vProps=vProps.concat(["marginTop","marginBottom"]).concat(cProps);hProps=hProps.concat(["marginLeft","marginRight"]);props2=props.concat(vProps).concat(hProps);el.find("*[width]").each(function(){child=$(this);if(restore)$.effects.save(child,props2);var c_original={height:child.height(),width:child.width()};child.from={height:c_original.height*factor.from.y,width:c_original.width*factor.from.x};child.to={height:c_original.height*factor.to.y,width:c_original.width*factor.to.x};if(factor.from.y!=factor.to.y){child.from=$.effects.setTransition(child,vProps,factor.from.y,child.from);child.to=$.effects.setTransition(child,vProps,factor.to.y,child.to)}if(factor.from.x!=factor.to.x){child.from=$.effects.setTransition(child,hProps,factor.from.x,child.from);child.to=$.effects.setTransition(child,hProps,factor.to.x,child.to)}child.css(child.from);child.animate(child.to,o.duration,o.options.easing,function(){if(restore)$.effects.restore(child,props2)})})}el.animate(el.to,{queue:false,duration:o.duration,easing:o.options.easing,complete:function(){if(el.to.opacity===0){el.css("opacity",el.from.opacity)}if(mode=="hide")el.hide();$.effects.restore(el,restore?props:props1);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(this,arguments);el.dequeue()}})})}})(jQuery);(function($,undefined){$.effects.shake=function(o){return this.queue(function(){var el=$(this),props=["position","top","bottom","left","right"];var mode=$.effects.setMode(el,o.options.mode||"effect");var direction=o.options.direction||"left";var distance=o.options.distance||20;var times=o.options.times||3;var speed=o.duration||o.options.duration||140;$.effects.save(el,props);el.show();$.effects.createWrapper(el);var ref=direction=="up"||direction=="down"?"top":"left";var motion=direction=="up"||direction=="left"?"pos":"neg";var animation={},animation1={},animation2={};animation[ref]=(motion=="pos"?"-=":"+=")+distance;animation1[ref]=(motion=="pos"?"+=":"-=")+distance*2;animation2[ref]=(motion=="pos"?"-=":"+=")+distance*2;el.animate(animation,speed,o.options.easing);for(var i=1;i<times;i++){el.animate(animation1,speed,o.options.easing).animate(animation2,speed,o.options.easing)}el.animate(animation1,speed,o.options.easing).animate(animation,speed/2,o.options.easing,function(){$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(this,arguments)});el.queue("fx",function(){el.dequeue()});el.dequeue()})}})(jQuery);(function($,undefined){$.effects.slide=function(o){return this.queue(function(){var el=$(this),props=["position","top","bottom","left","right"];var mode=$.effects.setMode(el,o.options.mode||"show");var direction=o.options.direction||"left";$.effects.save(el,props);el.show();$.effects.createWrapper(el).css({overflow:"hidden"});var ref=direction=="up"||direction=="down"?"top":"left";var motion=direction=="up"||direction=="left"?"pos":"neg";var distance=o.options.distance||(ref=="top"?el.outerHeight({margin:true}):el.outerWidth({margin:true}));if(mode=="show")el.css(ref,motion=="pos"?isNaN(distance)?"-"+distance:-distance:distance);var animation={};animation[ref]=(mode=="show"?motion=="pos"?"+=":"-=":motion=="pos"?"-=":"+=")+distance;el.animate(animation,{queue:false,duration:o.duration,easing:o.options.easing,complete:function(){if(mode=="hide")el.hide();$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(this,arguments);el.dequeue()}})})}})(jQuery);(function($,undefined){$.effects.transfer=function(o){return this.queue(function(){var elem=$(this),target=$(o.options.to),endPosition=target.offset(),animation={top:endPosition.top,left:endPosition.left,height:target.innerHeight(),width:target.innerWidth()},startPosition=elem.offset(),transfer=$('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(o.options.className).css({top:startPosition.top,left:startPosition.left,height:elem.innerHeight(),width:elem.innerWidth(),position:"absolute"}).animate(animation,o.duration,o.options.easing,function(){transfer.remove();o.callback&&o.callback.apply(elem[0],arguments);elem.dequeue()})})}})(jQuery);(function($,undefined){$.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var self=this,options=self.options;self.running=0;self.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix");self.headers=self.element.find(options.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){if(options.disabled){return}$(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){if(options.disabled){return}$(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){if(options.disabled){return}$(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){if(options.disabled){return}$(this).removeClass("ui-state-focus")});self.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(options.navigation){var current=self.element.find("a").filter(options.navigationFilter).eq(0);if(current.length){var header=current.closest(".ui-accordion-header");if(header.length){self.active=header}else{self.active=current.closest(".ui-accordion-content").prev()}}}self.active=self._findActive(self.active||options.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");self.active.next().addClass("ui-accordion-content-active");self._createIcons();self.resize();self.element.attr("role","tablist");self.headers.attr("role","tab").bind("keydown.accordion",function(event){return self._keydown(event)}).next().attr("role","tabpanel");self.headers.not(self.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide();if(!self.active.length){self.headers.eq(0).attr("tabIndex",0)}else{self.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0})}if(!$.browser.safari){self.headers.find("a").attr("tabIndex",-1)}if(options.event){self.headers.bind(options.event.split(" ").join(".accordion ")+".accordion",function(event){self._clickHandler.call(self,event,this);event.preventDefault()})}},_createIcons:function(){var options=this.options;if(options.icons){$("<span></span>").addClass("ui-icon "+options.icons.header).prependTo(this.headers);this.active.children(".ui-icon").toggleClass(options.icons.header).toggleClass(options.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var options=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex");this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var contents=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");if(options.autoHeight||options.fillHeight){contents.css("height","")}return $.Widget.prototype.destroy.call(this)},_setOption:function(key,value){$.Widget.prototype._setOption.apply(this,arguments);if(key=="active"){this.activate(value)}if(key=="icons"){this._destroyIcons();if(value){this._createIcons()}}if(key=="disabled"){this.headers.add(this.headers.next())[value?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")}},_keydown:function(event){if(this.options.disabled||event.altKey||event.ctrlKey){return}var keyCode=$.ui.keyCode,length=this.headers.length,currentIndex=this.headers.index(event.target),toFocus=false;
switch(event.keyCode){case keyCode.RIGHT:case keyCode.DOWN:toFocus=this.headers[(currentIndex+1)%length];break;case keyCode.LEFT:case keyCode.UP:toFocus=this.headers[(currentIndex-1+length)%length];break;case keyCode.SPACE:case keyCode.ENTER:this._clickHandler({target:event.target},event.target);event.preventDefault()}if(toFocus){$(event.target).attr("tabIndex",-1);$(toFocus).attr("tabIndex",0);toFocus.focus();return false}return true},resize:function(){var options=this.options,maxHeight;if(options.fillSpace){if($.browser.msie){var defOverflow=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}maxHeight=this.element.parent().height();if($.browser.msie){this.element.parent().css("overflow",defOverflow)}this.headers.each(function(){maxHeight-=$(this).outerHeight(true)});this.headers.next().each(function(){$(this).height(Math.max(0,maxHeight-$(this).innerHeight()+$(this).height()))}).css("overflow","auto")}else if(options.autoHeight){maxHeight=0;this.headers.next().each(function(){maxHeight=Math.max(maxHeight,$(this).height("").height())}).height(maxHeight)}return this},activate:function(index){this.options.active=index;var active=this._findActive(index)[0];this._clickHandler({target:active},active);return this},_findActive:function(selector){return selector?typeof selector==="number"?this.headers.filter(":eq("+selector+")"):this.headers.not(this.headers.not(selector)):selector===false?$([]):this.headers.filter(":eq(0)")},_clickHandler:function(event,target){var options=this.options;if(options.disabled){return}if(!event.target){if(!options.collapsible){return}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(options.icons.headerSelected).addClass(options.icons.header);this.active.next().addClass("ui-accordion-content-active");var toHide=this.active.next(),data={options:options,newHeader:$([]),oldHeader:options.active,newContent:$([]),oldContent:toHide},toShow=this.active=$([]);this._toggle(toShow,toHide,data);return}var clicked=$(event.currentTarget||target),clickedIsActive=clicked[0]===this.active[0];options.active=options.collapsible&&clickedIsActive?false:this.headers.index(clicked);if(this.running||!options.collapsible&&clickedIsActive){return}var active=this.active,toShow=clicked.next(),toHide=this.active.next(),data={options:options,newHeader:clickedIsActive&&options.collapsible?$([]):clicked,oldHeader:this.active,newContent:clickedIsActive&&options.collapsible?$([]):toShow,oldContent:toHide},down=this.headers.index(this.active[0])>this.headers.index(clicked[0]);this.active=clickedIsActive?$([]):clicked;this._toggle(toShow,toHide,data,clickedIsActive,down);active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(options.icons.headerSelected).addClass(options.icons.header);if(!clickedIsActive){clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(options.icons.header).addClass(options.icons.headerSelected);clicked.next().addClass("ui-accordion-content-active")}return},_toggle:function(toShow,toHide,data,clickedIsActive,down){var self=this,options=self.options;self.toShow=toShow;self.toHide=toHide;self.data=data;var complete=function(){if(!self){return}return self._completed.apply(self,arguments)};self._trigger("changestart",null,self.data);self.running=toHide.size()===0?toShow.size():toHide.size();if(options.animated){var animOptions={};if(options.collapsible&&clickedIsActive){animOptions={toShow:$([]),toHide:toHide,complete:complete,down:down,autoHeight:options.autoHeight||options.fillSpace}}else{animOptions={toShow:toShow,toHide:toHide,complete:complete,down:down,autoHeight:options.autoHeight||options.fillSpace}}if(!options.proxied){options.proxied=options.animated}if(!options.proxiedDuration){options.proxiedDuration=options.duration}options.animated=$.isFunction(options.proxied)?options.proxied(animOptions):options.proxied;options.duration=$.isFunction(options.proxiedDuration)?options.proxiedDuration(animOptions):options.proxiedDuration;var animations=$.ui.accordion.animations,duration=options.duration,easing=options.animated;if(easing&&!animations[easing]&&!$.easing[easing]){easing="slide"}if(!animations[easing]){animations[easing]=function(options){this.slide(options,{easing:easing,duration:duration||700})}}animations[easing](animOptions)}else{if(options.collapsible&&clickedIsActive){toShow.toggle()}else{toHide.hide();toShow.show()}complete(true)}toHide.prev().attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).blur();toShow.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(cancel){this.running=cancel?0:--this.running;if(this.running){return}if(this.options.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})}this.toHide.removeClass("ui-accordion-content-active");if(this.toHide.length){this.toHide.parent()[0].className=this.toHide.parent()[0].className}this._trigger("change",null,this.data)}});$.extend($.ui.accordion,{version:"1.8.12",animations:{slide:function(options,additions){options=$.extend({easing:"swing",duration:300},options,additions);if(!options.toHide.size()){options.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},options);return}if(!options.toShow.size()){options.toHide.animate({height:"hide",paddingTop:"hide",paddingBottom:"hide"},options);return}var overflow=options.toShow.css("overflow"),percentDone=0,showProps={},hideProps={},fxAttrs=["height","paddingTop","paddingBottom"],originalWidth;var s=options.toShow;originalWidth=s[0].style.width;s.width(parseInt(s.parent().width(),10)-parseInt(s.css("paddingLeft"),10)-parseInt(s.css("paddingRight"),10)-(parseInt(s.css("borderLeftWidth"),10)||0)-(parseInt(s.css("borderRightWidth"),10)||0));$.each(fxAttrs,function(i,prop){hideProps[prop]="hide";var parts=(""+$.css(options.toShow[0],prop)).match(/^([\d+-.]+)(.*)$/);showProps[prop]={value:parts[1],unit:parts[2]||"px"}});options.toShow.css({height:0,overflow:"hidden"}).show();options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate(hideProps,{step:function(now,settings){if(settings.prop=="height"){percentDone=settings.end-settings.start===0?0:(settings.now-settings.start)/(settings.end-settings.start)}options.toShow[0].style[settings.prop]=percentDone*showProps[settings.prop].value+showProps[settings.prop].unit},duration:options.duration,easing:options.easing,complete:function(){if(!options.autoHeight){options.toShow.css("height","")}options.toShow.css({width:originalWidth,overflow:overflow});options.complete()}})},bounceslide:function(options){this.slide(options,{easing:options.down?"easeOutBounce":"swing",duration:options.down?1e3:200})}}})})(jQuery);(function($,undefined){var requestIndex=0;$.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var self=this,doc=this.element[0].ownerDocument,suppressKeyPress;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(event){if(self.options.disabled||self.element.attr("readonly")){return}suppressKeyPress=false;var keyCode=$.ui.keyCode;switch(event.keyCode){case keyCode.PAGE_UP:self._move("previousPage",event);break;case keyCode.PAGE_DOWN:self._move("nextPage",event);break;case keyCode.UP:self._move("previous",event);event.preventDefault();break;case keyCode.DOWN:self._move("next",event);event.preventDefault();break;case keyCode.ENTER:case keyCode.NUMPAD_ENTER:if(self.menu.active){suppressKeyPress=true;event.preventDefault()}case keyCode.TAB:if(!self.menu.active){return}self.menu.select(event);break;case keyCode.ESCAPE:self.element.val(self.term);self.close(event);break;default:clearTimeout(self.searching);self.searching=setTimeout(function(){if(self.term!=self.element.val()){self.selectedItem=null;self.search(null,event)}},self.options.delay);break}}).bind("keypress.autocomplete",function(event){if(suppressKeyPress){suppressKeyPress=false;event.preventDefault()}}).bind("focus.autocomplete",function(){if(self.options.disabled){return}self.selectedItem=null;self.previous=self.element.val()}).bind("blur.autocomplete",function(event){if(self.options.disabled){return}clearTimeout(self.searching);self.closing=setTimeout(function(){self.close(event);self._change(event)},150)});this._initSource();this.response=function(){return self._response.apply(self,arguments)};this.menu=$("<ul></ul>").addClass("ui-autocomplete").appendTo($(this.options.appendTo||"body",doc)[0]).mousedown(function(event){var menuElement=self.menu.element[0];if(!$(event.target).closest(".ui-menu-item").length){setTimeout(function(){$(document).one("mousedown",function(event){if(event.target!==self.element[0]&&event.target!==menuElement&&!$.ui.contains(menuElement,event.target)){self.close()}})},1)}setTimeout(function(){clearTimeout(self.closing)},13)}).menu({focus:function(event,ui){var item=ui.item.data("item.autocomplete");if(false!==self._trigger("focus",event,{item:item})){if(/^key/.test(event.originalEvent.type)){self.element.val(item.value)}}},selected:function(event,ui){var item=ui.item.data("item.autocomplete"),previous=self.previous;if(self.element[0]!==doc.activeElement){self.element.focus();self.previous=previous;setTimeout(function(){self.previous=previous;self.selectedItem=item},1)}if(false!==self._trigger("select",event,{item:item})){self.element.val(item.value)}self.term=self.element.val();self.close(event);self.selectedItem=item},blur:function(event,ui){if(self.menu.element.is(":visible")&&self.element.val()!==self.term){self.element.val(self.term)}}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");if($.fn.bgiframe){this.menu.element.bgiframe()}},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();$.Widget.prototype.destroy.call(this)},_setOption:function(key,value){$.Widget.prototype._setOption.apply(this,arguments);if(key==="source"){this._initSource()}if(key==="appendTo"){this.menu.element.appendTo($(value||"body",this.element[0].ownerDocument)[0])}if(key==="disabled"&&value&&this.xhr){this.xhr.abort()}},_initSource:function(){var self=this,array,url;if($.isArray(this.options.source)){array=this.options.source;this.source=function(request,response){response($.ui.autocomplete.filter(array,request.term))}}else if(typeof this.options.source==="string"){url=this.options.source;this.source=function(request,response){if(self.xhr){self.xhr.abort()}self.xhr=$.ajax({url:url,data:request,dataType:"json",autocompleteRequest:++requestIndex,success:function(data,status){if(this.autocompleteRequest===requestIndex){response(data)}},error:function(){if(this.autocompleteRequest===requestIndex){response([])}}})}}else{this.source=this.options.source}},search:function(value,event){value=value!=null?value:this.element.val();this.term=this.element.val();if(value.length<this.options.minLength){return this.close(event)}clearTimeout(this.closing);if(this._trigger("search",event)===false){return}return this._search(value)},_search:function(value){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:value},this.response)},_response:function(content){if(!this.options.disabled&&content&&content.length){content=this._normalize(content);this._suggest(content);this._trigger("open")}else{this.close()}this.pending--;if(!this.pending){this.element.removeClass("ui-autocomplete-loading")}},close:function(event){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.deactivate();this._trigger("close",event)}},_change:function(event){if(this.previous!==this.element.val()){this._trigger("change",event,{item:this.selectedItem})}},_normalize:function(items){if(items.length&&items[0].label&&items[0].value){return items}return $.map(items,function(item){if(typeof item==="string"){return{label:item,value:item}}return $.extend({label:item.label||item.value,value:item.value||item.label},item)})},_suggest:function(items){var ul=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(ul,items);this.menu.deactivate();this.menu.refresh();ul.show();this._resizeMenu();ul.position($.extend({of:this.element},this.options.position));if(this.options.autoFocus){this.menu.next(new $.Event("mouseover"))}},_resizeMenu:function(){var ul=this.menu.element;ul.outerWidth(Math.max(ul.width("").outerWidth(),this.element.outerWidth()))},_renderMenu:function(ul,items){var self=this;$.each(items,function(index,item){self._renderItem(ul,item)})},_renderItem:function(ul,item){return $("<li></li>").data("item.autocomplete",item).append($("<a></a>").text(item.label)).appendTo(ul)},_move:function(direction,event){if(!this.menu.element.is(":visible")){this.search(null,event);return}if(this.menu.first()&&/^previous/.test(direction)||this.menu.last()&&/^next/.test(direction)){this.element.val(this.term);this.menu.deactivate();return}this.menu[direction](event)},widget:function(){return this.menu.element}});$.extend($.ui.autocomplete,{escapeRegex:function(value){return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(array,term){var matcher=new RegExp($.ui.autocomplete.escapeRegex(term),"i");return $.grep(array,function(value){return matcher.test(value.label||value.value||value)})}})})(jQuery);(function($){$.widget("ui.menu",{_create:function(){var self=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(event){if(!$(event.target).closest(".ui-menu-item a").length){return}event.preventDefault();self.select(event)});this.refresh()},refresh:function(){var self=this;var items=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");items.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(event){self.activate(event,$(this).parent())}).mouseleave(function(){self.deactivate()})},activate:function(event,item){this.deactivate();if(this.hasScroll()){var offset=item.offset().top-this.element.offset().top,scroll=this.element.attr("scrollTop"),elementHeight=this.element.height();if(offset<0){this.element.attr("scrollTop",scroll+offset)}else if(offset>=elementHeight){this.element.attr("scrollTop",scroll+offset-elementHeight+item.height())}}this.active=item.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",event,{item:item})},deactivate:function(){if(!this.active){return}this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null},next:function(event){this.move("next",".ui-menu-item:first",event)},previous:function(event){this.move("prev",".ui-menu-item:last",event)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(direction,edge,event){if(!this.active){this.activate(event,this.element.children(edge));return}var next=this.active[direction+"All"](".ui-menu-item").eq(0);if(next.length){this.activate(event,next)}else{this.activate(event,this.element.children(edge))}},nextPage:function(event){if(this.hasScroll()){if(!this.active||this.last()){this.activate(event,this.element.children(".ui-menu-item:first"));return}var base=this.active.offset().top,height=this.element.height(),result=this.element.children(".ui-menu-item").filter(function(){var close=$(this).offset().top-base-height+$(this).height();return close<10&&close>-10});if(!result.length){result=this.element.children(".ui-menu-item:last")}this.activate(event,result)}else{this.activate(event,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))}},previousPage:function(event){if(this.hasScroll()){if(!this.active||this.first()){this.activate(event,this.element.children(".ui-menu-item:last"));return}var base=this.active.offset().top,height=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var close=$(this).offset().top-base+height-$(this).height();return close<10&&close>-10});if(!result.length){result=this.element.children(".ui-menu-item:first")}this.activate(event,result)}else{this.activate(event,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))}},hasScroll:function(){return this.element.height()<this.element.attr("scrollHeight")},select:function(event){this._trigger("selected",event,{item:this.active})}})})(jQuery);(function($,undefined){var lastActive,baseClasses="ui-button ui-widget ui-state-default ui-corner-all",stateClasses="ui-state-hover ui-state-active ",typeClasses="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",formResetHandler=function(event){$(":ui-button",event.target.form).each(function(){var inst=$(this).data("button");setTimeout(function(){inst.refresh()},1)})},radioGroup=function(radio){var name=radio.name,form=radio.form,radios=$([]);if(name){if(form){radios=$(form).find("[name='"+name+"']")}else{radios=$("[name='"+name+"']",radio.ownerDocument).filter(function(){return!this.form})}}return radios};$.widget("ui.button",{options:{disabled:null,text:true,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",formResetHandler);if(typeof this.options.disabled!=="boolean"){this.options.disabled=this.element.attr("disabled")}this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var self=this,options=this.options,toggleButton=this.type==="checkbox"||this.type==="radio",hoverClass="ui-state-hover"+(!toggleButton?" ui-state-active":""),focusClass="ui-state-focus";if(options.label===null){options.label=this.buttonElement.html()}if(this.element.is(":disabled")){options.disabled=true}this.buttonElement.addClass(baseClasses).attr("role","button").bind("mouseenter.button",function(){if(options.disabled){return}$(this).addClass("ui-state-hover");if(this===lastActive){$(this).addClass("ui-state-active")}}).bind("mouseleave.button",function(){if(options.disabled){return}$(this).removeClass(hoverClass)}).bind("focus.button",function(){$(this).addClass(focusClass)}).bind("blur.button",function(){$(this).removeClass(focusClass)});if(toggleButton){this.element.bind("change.button",function(){self.refresh()})}if(this.type==="checkbox"){this.buttonElement.bind("click.button",function(){if(options.disabled){return false}$(this).toggleClass("ui-state-active");self.buttonElement.attr("aria-pressed",self.element[0].checked)})}else if(this.type==="radio"){this.buttonElement.bind("click.button",function(){if(options.disabled){return false}$(this).addClass("ui-state-active");self.buttonElement.attr("aria-pressed",true);var radio=self.element[0];radioGroup(radio).not(radio).map(function(){return $(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed",false)})}else{this.buttonElement.bind("mousedown.button",function(){if(options.disabled){return false}$(this).addClass("ui-state-active");lastActive=this;$(document).one("mouseup",function(){lastActive=null})}).bind("mouseup.button",function(){if(options.disabled){return false}$(this).removeClass("ui-state-active")}).bind("keydown.button",function(event){if(options.disabled){return false}if(event.keyCode==$.ui.keyCode.SPACE||event.keyCode==$.ui.keyCode.ENTER){$(this).addClass("ui-state-active")}}).bind("keyup.button",function(){$(this).removeClass("ui-state-active")});if(this.buttonElement.is("a")){this.buttonElement.keyup(function(event){if(event.keyCode===$.ui.keyCode.SPACE){$(this).click()}})}}this._setOption("disabled",options.disabled)},_determineButtonType:function(){if(this.element.is(":checkbox")){this.type="checkbox"}else if(this.element.is(":radio")){this.type="radio"}else if(this.element.is("input")){this.type="input"}else{this.type="button"}if(this.type==="checkbox"||this.type==="radio"){var ancestor=this.element.parents().filter(":last"),labelSelector="label[for="+this.element.attr("id")+"]";this.buttonElement=ancestor.find(labelSelector);if(!this.buttonElement.length){ancestor=ancestor.length?ancestor.siblings():this.element.siblings();this.buttonElement=ancestor.filter(labelSelector);if(!this.buttonElement.length){this.buttonElement=ancestor.find(labelSelector)}}this.element.addClass("ui-helper-hidden-accessible");var checked=this.element.is(":checked");if(checked){this.buttonElement.addClass("ui-state-active")}this.buttonElement.attr("aria-pressed",checked)}else{this.buttonElement=this.element}},widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible");this.buttonElement.removeClass(baseClasses+" "+stateClasses+" "+typeClasses).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html());if(!this.hasTitle){this.buttonElement.removeAttr("title")}$.Widget.prototype.destroy.call(this)},_setOption:function(key,value){$.Widget.prototype._setOption.apply(this,arguments);if(key==="disabled"){if(value){this.element.attr("disabled",true)}else{this.element.removeAttr("disabled")}}this._resetButton()},refresh:function(){var isDisabled=this.element.is(":disabled");if(isDisabled!==this.options.disabled){this._setOption("disabled",isDisabled)}if(this.type==="radio"){radioGroup(this.element[0]).each(function(){if($(this).is(":checked")){$(this).button("widget").addClass("ui-state-active").attr("aria-pressed",true)}else{$(this).button("widget").removeClass("ui-state-active").attr("aria-pressed",false)}})}else if(this.type==="checkbox"){if(this.element.is(":checked")){this.buttonElement.addClass("ui-state-active").attr("aria-pressed",true)}else{this.buttonElement.removeClass("ui-state-active").attr("aria-pressed",false)}}},_resetButton:function(){if(this.type==="input"){if(this.options.label){this.element.val(this.options.label)}return}var buttonElement=this.buttonElement.removeClass(typeClasses),buttonText=$("<span></span>").addClass("ui-button-text").html(this.options.label).appendTo(buttonElement.empty()).text(),icons=this.options.icons,multipleIcons=icons.primary&&icons.secondary,buttonClasses=[];if(icons.primary||icons.secondary){if(this.options.text){buttonClasses.push("ui-button-text-icon"+(multipleIcons?"s":icons.primary?"-primary":"-secondary"))}if(icons.primary){buttonElement.prepend("<span class='ui-button-icon-primary ui-icon "+icons.primary+"'></span>")}if(icons.secondary){buttonElement.append("<span class='ui-button-icon-secondary ui-icon "+icons.secondary+"'></span>")}if(!this.options.text){buttonClasses.push(multipleIcons?"ui-button-icons-only":"ui-button-icon-only");if(!this.hasTitle){buttonElement.attr("title",buttonText)}}}else{buttonClasses.push("ui-button-text-only")}buttonElement.addClass(buttonClasses.join(" "))}});$.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(key,value){if(key==="disabled"){this.buttons.button("option",key,value)}$.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return $(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass("ui-corner-left").end().filter(":last").addClass("ui-corner-right").end().end()},destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return $(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy");$.Widget.prototype.destroy.call(this)}})})(jQuery);(function($,undefined){$.extend($.ui,{datepicker:{version:"1.8.12"}});var PROP_NAME="datepicker";var dpuuid=(new Date).getTime();function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false};$.extend(this._defaults,this.regional[""]);this.dpDiv=$('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug)console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=nodeName=="div"||nodeName=="span";if(!target.id){this.uuid+=1;target.id="dp"+this.uuid}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else if(inline){this._inlineDatepicker(target,inst)}},_newInst:function(target,inline){var id=target[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:!inline?this.dpDiv:$('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')}},_connectDatepicker:function(target,inst){var input=$(target);inst.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName))return;this._attachments(input,inst);input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});this._autoSize(inst);$.data(target,PROP_NAME,inst)},_attachments:function(input,inst){var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(inst.append)inst.append.remove();if(appendText){inst.append=$('<span class="'+this._appendClass+'">'+appendText+"</span>");input[isRTL?"before":"after"](inst.append)}input.unbind("focus",this._showDatepicker);if(inst.trigger)inst.trigger.remove();var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both")input.focus(this._showDatepicker);if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");inst.trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==input[0])$.datepicker._hideDatepicker();else $.datepicker._showDatepicker(input[0]);return false})}},_autoSize:function(inst){if(this._get(inst,"autoSize")&&!inst.inline){var date=new Date(2009,12-1,20);var dateFormat=this._get(inst,"dateFormat");if(dateFormat.match(/[DM]/)){var findMax=function(names){var max=0;var maxI=0;for(var i=0;i<names.length;i++){if(names[i].length>max){max=names[i].length;maxI=i}}return maxI};date.setMonth(findMax(this._get(inst,dateFormat.match(/MM/)?"monthNames":"monthNamesShort")));date.setDate(findMax(this._get(inst,dateFormat.match(/DD/)?"dayNames":"dayNamesShort"))+20-date.getDay())}inst.input.attr("size",this._formatDate(inst,date).length)}},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName))return;divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst),true);this._updateDatepicker(inst);this._updateAlternate(inst);inst.dpDiv.show()},_dialogDatepicker:function(input,date,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){this.uuid+=1;var id="dp"+this.uuid;this._dialogInput=$('<input type="text" id="'+id+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});date=date&&date.constructor==Date?this._formatDate(inst,date):date;this._dialogInput.val(date);this._pos=pos?pos.length?pos:[pos.pageX,pos.pageY]:null;if(!this._pos){var browserWidth=document.documentElement.clientWidth;var browserHeight=document.documentElement.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[browserWidth/2-100+scrollX,browserHeight/2-150+scrollY]}this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI)$.blockUI(this.dpDiv);$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){inst.append.remove();inst.trigger.remove();
$target.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(nodeName=="div"||nodeName=="span")$target.removeClass(this.markerClassName).empty()},_enableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled")}this._disabledInputs=$.map(this._disabledInputs,function(value){return value==target?null:value})},_disableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled")}this._disabledInputs=$.map(this._disabledInputs,function(value){return value==target?null:value});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target)return true}return false},_getInst:function(target){try{return $.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(target,name,value){var inst=this._getInst(target);if(arguments.length==2&&typeof name=="string"){return name=="defaults"?$.extend({},$.datepicker._defaults):inst?name=="all"?$.extend({},inst.settings):this._get(inst,name):null}var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}if(inst){if(this._curInst==inst){this._hideDatepicker()}var date=this._getDateDatepicker(target,true);var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");extendRemove(inst.settings,settings);if(minDate!==null&&settings["dateFormat"]!==undefined&&settings["minDate"]===undefined)inst.settings.minDate=this._formatDate(inst,minDate);if(maxDate!==null&&settings["dateFormat"]!==undefined&&settings["maxDate"]===undefined)inst.settings.maxDate=this._formatDate(inst,maxDate);this._attachments($(target),inst);this._autoSize(inst);this._setDateDatepicker(target,date);this._updateDatepicker(inst)}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date){var inst=this._getInst(target);if(inst){this._setDate(inst,date);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target,noDefault){var inst=this._getInst(target);if(inst&&!inst.inline)this._setDateFromField(inst,noDefault);return inst?this._getDate(inst):null},_doKeyDown:function(event){var inst=$.datepicker._getInst(event.target);var handled=true;var isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if($.datepicker._datepickerShowing)switch(event.keyCode){case 9:$.datepicker._hideDatepicker();handled=false;break;case 13:var sel=$("td."+$.datepicker._dayOverClass+":not(."+$.datepicker._currentClass+")",inst.dpDiv);if(sel[0])$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0]);else $.datepicker._hideDatepicker();return false;break;case 27:$.datepicker._hideDatepicker();break;case 33:$.datepicker._adjustDate(event.target,event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths"),"M");break;case 34:$.datepicker._adjustDate(event.target,event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths"),"M");break;case 35:if(event.ctrlKey||event.metaKey)$.datepicker._clearDate(event.target);handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey)$.datepicker._gotoToday(event.target);handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey)$.datepicker._adjustDate(event.target,isRTL?+1:-1,"D");handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey)$.datepicker._adjustDate(event.target,event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths"),"M");break;case 38:if(event.ctrlKey||event.metaKey)$.datepicker._adjustDate(event.target,-7,"D");handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey)$.datepicker._adjustDate(event.target,isRTL?-1:+1,"D");handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey)$.datepicker._adjustDate(event.target,event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths"),"M");break;case 40:if(event.ctrlKey||event.metaKey)$.datepicker._adjustDate(event.target,+7,"D");handled=event.ctrlKey||event.metaKey;break;default:handled=false}else if(event.keyCode==36&&event.ctrlKey)$.datepicker._showDatepicker(this);else{handled=false}if(handled){event.preventDefault();event.stopPropagation()}},_doKeyPress:function(event){var inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){var chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||event.metaKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},_doKeyUp:function(event){var inst=$.datepicker._getInst(event.target);if(inst.input.val()!=inst.lastVal){try{var date=$.datepicker.parseDate($.datepicker._get(inst,"dateFormat"),inst.input?inst.input.val():null,$.datepicker._getFormatConfig(inst));if(date){$.datepicker._setDateFromField(inst);$.datepicker._updateAlternate(inst);$.datepicker._updateDatepicker(inst)}}catch(event){$.datepicker.log(event)}}return true},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input")input=$("input",input.parentNode)[0];if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input)return;var inst=$.datepicker._getInst(input);if($.datepicker._curInst&&$.datepicker._curInst!=inst){$.datepicker._curInst.dpDiv.stop(true,true)}var beforeShow=$.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,beforeShow?beforeShow.apply(input,[input,inst]):{});inst.lastVal=null;$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog)input.value="";if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return!isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.dpDiv.empty();inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":isFixed?"fixed":"absolute",display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim");var duration=$.datepicker._get(inst,"duration");var postProcess=function(){$.datepicker._datepickerShowing=true;var cover=inst.dpDiv.find("iframe.ui-datepicker-cover");if(!!cover.length){var borders=$.datepicker._getBorders(inst.dpDiv);cover.css({left:-borders[0],top:-borders[1],width:inst.dpDiv.outerWidth(),height:inst.dpDiv.outerHeight()})}};inst.dpDiv.zIndex($(input).zIndex()+1);if($.effects&&$.effects[showAnim])inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess);else inst.dpDiv[showAnim||"show"](showAnim?duration:null,postProcess);if(!showAnim||!duration)postProcess();if(inst.input.is(":visible")&&!inst.input.is(":disabled"))inst.input.focus();$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var self=this;var borders=$.datepicker._getBorders(inst.dpDiv);inst.dpDiv.empty().append(this._generateHTML(inst));var cover=inst.dpDiv.find("iframe.ui-datepicker-cover");if(!!cover.length){cover.css({left:-borders[0],top:-borders[1],width:inst.dpDiv.outerWidth(),height:inst.dpDiv.outerHeight()})}inst.dpDiv.find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1)$(this).removeClass("ui-datepicker-prev-hover");if(this.className.indexOf("ui-datepicker-next")!=-1)$(this).removeClass("ui-datepicker-next-hover")}).bind("mouseover",function(){if(!self._isDisabledDatepicker(inst.inline?inst.dpDiv.parent()[0]:inst.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1)$(this).addClass("ui-datepicker-prev-hover");if(this.className.indexOf("ui-datepicker-next")!=-1)$(this).addClass("ui-datepicker-next-hover")}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;if(cols>1)inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",width*cols+"em");else inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst==$.datepicker._curInst&&$.datepicker._datepickerShowing&&inst.input&&inst.input.is(":visible")&&!inst.input.is(":disabled")&&inst.input[0]!=document.activeElement)inst.input.focus();if(inst.yearshtml){var origyearshtml=inst.yearshtml;setTimeout(function(){if(origyearshtml===inst.yearshtml){inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml)}origyearshtml=inst.yearshtml=null},0)}},_getBorders:function(elem){var convert=function(value){return{thin:1,medium:2,thick:3}[value]||value};return[parseFloat(convert(elem.css("border-left-width"))),parseFloat(convert(elem.css("border-top-width")))]},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=document.documentElement.clientWidth+$(document).scrollLeft();var viewHeight=document.documentElement.clientHeight+$(document).scrollTop();offset.left-=this._get(inst,"isRTL")?dpWidth-inputWidth:0;offset.left-=isFixed&&offset.left==inst.input.offset().left?$(document).scrollLeft():0;offset.top-=isFixed&&offset.top==inst.input.offset().top+inputHeight?$(document).scrollTop():0;offset.left-=Math.min(offset.left,offset.left+dpWidth>viewWidth&&viewWidth>dpWidth?Math.abs(offset.left+dpWidth-viewWidth):0);offset.top-=Math.min(offset.top,offset.top+dpHeight>viewHeight&&viewHeight>dpHeight?Math.abs(dpHeight+inputHeight):0);return offset},_findPos:function(obj){var inst=this._getInst(obj);var isRTL=this._get(inst,"isRTL");while(obj&&(obj.type=="hidden"||obj.nodeType!=1||$.expr.filters.hidden(obj))){obj=obj[isRTL?"previousSibling":"nextSibling"]}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input){var inst=this._curInst;if(!inst||input&&inst!=$.data(input,PROP_NAME))return;if(this._datepickerShowing){var showAnim=this._get(inst,"showAnim");var duration=this._get(inst,"duration");var postProcess=function(){$.datepicker._tidyDialog(inst);this._curInst=null};if($.effects&&$.effects[showAnim])inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess);else inst.dpDiv[showAnim=="slideDown"?"slideUp":showAnim=="fadeIn"?"fadeOut":"hide"](showAnim?duration:null,postProcess);if(!showAnim)postProcess();var onClose=this._get(inst,"onClose");if(onClose)onClose.apply(inst.input?inst.input[0]:null,[inst.input?inst.input.val():"",inst]);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!$.datepicker._curInst)return;var $target=$(event.target);if($target[0].id!=$.datepicker._mainDivId&&$target.parents("#"+$.datepicker._mainDivId).length==0&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI))$.datepicker._hideDatepicker()},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date;inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear){setTimeout(function(){inst.input.focus()},0)}inst._selectingMonthYear=!inst._selectingMonthYear},_selectDay:function(id,month,year,td){var target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=dateStr!=null?dateStr:this._formatDate(inst);if(inst.input)inst.input.val(dateStr);this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect)onSelect.apply(inst.input?inst.input[0]:null,[dateStr,inst]);else if(inst.input)inst.input.trigger("change");if(inst.inline)this._updateDatepicker(inst);else{this._hideDatepicker();this._lastInput=inst.input[0];if(typeof inst.input[0]!="object")inst.input.focus();this._lastInput=null}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);var dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[day>0&&day<6,""]},iso8601Week:function(date){var checkDate=new Date(date.getTime());checkDate.setDate(checkDate.getDate()+4-(checkDate.getDay()||7));var time=checkDate.getTime();checkDate.setMonth(0);checkDate.setDate(1);return Math.floor(Math.round((time-checkDate)/864e5)/7)+1},parseDate:function(format,value,settings){if(format==null||value==null)throw"Invalid arguments";value=typeof value=="object"?value.toString():value+"";if(value=="")return null;var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;shortYearCutoff=typeof shortYearCutoff!="string"?shortYearCutoff:(new Date).getFullYear()%100+parseInt(shortYearCutoff,10);var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=iFormat+1<format.length&&format.charAt(iFormat+1)==match;if(matches)iFormat++;return matches};var getNumber=function(match){var isDoubled=lookAhead(match);var size=match=="@"?14:match=="!"?20:match=="y"&&isDoubled?4:match=="o"?3:2;var digits=new RegExp("^\\d{1,"+size+"}");var num=value.substring(iValue).match(digits);if(!num)throw"Missing number at position "+iValue;iValue+=num[0].length;return parseInt(num[0],10)};var getName=function(match,shortNames,longNames){var names=lookAhead(match)?longNames:shortNames;for(var i=0;i<names.length;i++){if(value.substr(iValue,names[i].length).toLowerCase()==names[i].toLowerCase()){iValue+=names[i].length;return i+1}}throw"Unknown name at position "+iValue};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat))throw"Unexpected literal at position "+iValue;iValue++};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal)if(format.charAt(iFormat)=="'"&&!lookAhead("'"))literal=false;else checkLiteral();else switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":var date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"!":var date=new Date((getNumber("!")-this._ticksTo1970)/1e4);year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'"))checkLiteral();else literal=true;break;default:checkLiteral()}}if(year==-1)year=(new Date).getFullYear();else if(year<100)year+=(new Date).getFullYear()-(new Date).getFullYear()%100+(year<=shortYearCutoff?0:-100);if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim)break;month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day)throw"Invalid date";return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:((1970-1)*365+Math.floor(1970/4)-Math.floor(1970/100)+Math.floor(1970/400))*24*60*60*1e7,formatDate:function(format,date,settings){if(!date)return"";var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=iFormat+1<format.length&&format.charAt(iFormat+1)==match;if(matches)iFormat++;return matches};var formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match))while(num.length<len)num="0"+num;return num};var formatName=function(match,value,shortNames,longNames){return lookAhead(match)?longNames[value]:shortNames[value]};var output="";var literal=false;if(date)for(var iFormat=0;iFormat<format.length;iFormat++){if(literal)if(format.charAt(iFormat)=="'"&&!lookAhead("'"))literal=false;else output+=format.charAt(iFormat);else switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":output+=formatNumber("o",(date.getTime()-new Date(date.getFullYear(),0,0).getTime())/864e5,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100;break;case"@":output+=date.getTime();break;case"!":output+=date.getTime()*1e4+this._ticksTo1970;break;case"'":if(lookAhead("'"))output+="'";else literal=true;break;default:output+=format.charAt(iFormat)}}return output},_possibleChars:function(format){var chars="";var literal=false;var lookAhead=function(match){var matches=iFormat+1<format.length&&format.charAt(iFormat+1)==match;if(matches)iFormat++;return matches};for(var iFormat=0;iFormat<format.length;iFormat++)if(literal)if(format.charAt(iFormat)=="'"&&!lookAhead("'"))literal=false;else chars+=format.charAt(iFormat);else switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'"))chars+="'";else literal=true;break;default:chars+=format.charAt(iFormat)}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst,noDefault){if(inst.input.val()==inst.lastVal){return}var dateFormat=this._get(inst,"dateFormat");var dates=inst.lastVal=inst.input?inst.input.val():null;var date,defaultDate;date=defaultDate=this._getDefaultDate(inst);var settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate}catch(event){this.log(event);dates=noDefault?"":dates}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=dates?date.getDate():0;inst.currentMonth=dates?date.getMonth():0;inst.currentYear=dates?date.getFullYear():0;this._adjustInstDate(inst)},_getDefaultDate:function(inst){return this._restrictMinMax(inst,this._determineDate(inst,this._get(inst,"defaultDate"),new Date))},_determineDate:function(inst,date,defaultDate){var offsetNumeric=function(offset){var date=new Date;date.setDate(date.getDate()+offset);return date};var offsetString=function(offset){try{return $.datepicker.parseDate($.datepicker._get(inst,"dateFormat"),offset,$.datepicker._getFormatConfig(inst))}catch(e){}var date=(offset.toLowerCase().match(/^c/)?$.datepicker._getDate(inst):null)||new Date;var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,$.datepicker._getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,$.datepicker._getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};var newDate=date==null||date===""?defaultDate:typeof date=="string"?offsetString(date):typeof date=="number"?isNaN(date)?defaultDate:offsetNumeric(date):new Date(date.getTime());newDate=newDate&&newDate.toString()=="Invalid Date"?defaultDate:newDate;if(newDate){newDate.setHours(0);newDate.setMinutes(0);newDate.setSeconds(0);newDate.setMilliseconds(0)}return this._daylightSavingAdjust(newDate)},_daylightSavingAdjust:function(date){if(!date)return null;date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,noChange){var clear=!date;var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;var newDate=this._restrictMinMax(inst,this._determineDate(inst,date,new Date));inst.selectedDay=inst.currentDay=newDate.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=newDate.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=newDate.getFullYear();if((origMonth!=inst.selectedMonth||origYear!=inst.selectedYear)&&!noChange)this._notifyChange(inst);this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){var startDate=!inst.currentYear||inst.input&&inst.input.val()==""?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));return startDate},_generateHTML:function(inst){var today=new Date;today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,"isRTL");var showButtonPanel=this._get(inst,"showButtonPanel");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var isMultiMonth=numMonths[0]!=1||numMonths[1]!=1;var currentDate=this._daylightSavingAdjust(!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay));var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[0]*numMonths[1]+1,maxDate.getDate()));maxDraw=minDate&&maxDraw<minDate?minDate:maxDraw;while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,"prevText");prevText=!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst));var prev=this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+dpuuid+".datepicker._adjustDate('#"+inst.id+"', -"+stepMonths+", 'M');\""+' title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>":hideIfNoPrevNext?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>";var nextText=this._get(inst,"nextText");nextText=!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst));var next=this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+dpuuid+".datepicker._adjustDate('#"+inst.id+"', +"+stepMonths+", 'M');\""+' title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>":hideIfNoPrevNext?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>";var currentText=this._get(inst,"currentText");var gotoDate=this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today;currentText=!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst));var controls=!inst.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+dpuuid+'.datepicker._hideDatepicker();">'+this._get(inst,"closeText")+"</button>":"";var buttonPanel=showButtonPanel?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+dpuuid+".datepicker._gotoToday('#"+inst.id+"');\""+">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";var firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=isNaN(firstDay)?0:firstDay;var showWeek=this._get(inst,"showWeek");var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var monthNamesShort=this._get(inst,"monthNamesShort");var beforeShowDay=this._get(inst,"beforeShowDay");var showOtherMonths=this._get(inst,"showOtherMonths");var selectOtherMonths=this._get(inst,"selectOtherMonths");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var defaultDate=this._getDefaultDate(inst);var html="";for(var row=0;row<numMonths[0];row++){var group="";for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));var cornerClass=" ui-corner-all";var calender="";if(isMultiMonth){calender+='<div class="ui-datepicker-group';if(numMonths[1]>1)switch(col){case 0:calender+=" ui-datepicker-group-first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+=" ui-datepicker-group-last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+=" ui-datepicker-group-middle";cornerClass="";break}calender+='">'}calender+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+cornerClass+'">'+(/all|left/.test(cornerClass)&&row==0?isRTL?next:prev:"")+(/all|right/.test(cornerClass)&&row==0?isRTL?prev:next:"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,row>0||col>0,monthNames,monthNamesShort)+'</div><table class="ui-datepicker-calendar"><thead>'+"<tr>";var thead=showWeek?'<th class="ui-datepicker-week-col">'+this._get(inst,"weekHeader")+"</th>":"";for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+="<th"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end"':"")+">"+'<span title="'+dayNames[day]+'">'+dayNamesMin[day]+"</span></th>"}calender+=thead+"</tr></thead><tbody>";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth)inst.selectedDay=Math.min(inst.selectedDay,daysInMonth);var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7);var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){calender+="<tr>";var tbody=!showWeek?"":'<td class="ui-datepicker-week-col">'+this._get(inst,"calculateWeek")(printDate)+"</td>";for(var dow=0;dow<7;dow++){var daySettings=beforeShowDay?beforeShowDay.apply(inst.input?inst.input[0]:null,[printDate]):[true,""];var otherMonth=printDate.getMonth()!=drawMonth;var unselectable=otherMonth&&!selectOtherMonths||!daySettings[0]||minDate&&printDate<minDate||maxDate&&printDate>maxDate;tbody+='<td class="'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(otherMonth?" ui-datepicker-other-month":"")+(printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent||defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime()?" "+this._dayOverClass:"")+(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()==currentDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?"":' onclick="DP_jQuery_'+dpuuid+".datepicker._selectDay('#"+inst.id+"',"+printDate.getMonth()+","+printDate.getFullYear()+', this);return false;"')+">"+(otherMonth&&!showOtherMonths?" ":unselectable?'<span class="ui-state-default">'+printDate.getDate()+"</span>":'<a class="ui-state-default'+(printDate.getTime()==today.getTime()?" ui-state-highlight":"")+(printDate.getTime()==currentDate.getTime()?" ui-state-active":"")+(otherMonth?" ui-priority-secondary":"")+'" href="#">'+printDate.getDate()+"</a>")+"</td>";
printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+"</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="</tbody></table>"+(isMultiMonth?"</div>"+(numMonths[0]>0&&col==numMonths[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");group+=calender}html+=group}html+=buttonPanel+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,secondary,monthNames,monthNamesShort){var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='<div class="ui-datepicker-title">';var monthHtml="";if(secondary||!changeMonth)monthHtml+='<span class="ui-datepicker-month">'+monthNames[drawMonth]+"</span>";else{var inMinYear=minDate&&minDate.getFullYear()==drawYear;var inMaxYear=maxDate&&maxDate.getFullYear()==drawYear;monthHtml+='<select class="ui-datepicker-month" '+'onchange="DP_jQuery_'+dpuuid+".datepicker._selectMonthYear('#"+inst.id+"', this, 'M');\" "+'onclick="DP_jQuery_'+dpuuid+".datepicker._clickMonthYear('#"+inst.id+"');\""+">";for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth()))monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNamesShort[month]+"</option>"}monthHtml+="</select>"}if(!showMonthAfterYear)html+=monthHtml+(secondary||!(changeMonth&&changeYear)?" ":"");if(!inst.yearshtml){inst.yearshtml="";if(secondary||!changeYear)html+='<span class="ui-datepicker-year">'+drawYear+"</span>";else{var years=this._get(inst,"yearRange").split(":");var thisYear=(new Date).getFullYear();var determineYear=function(value){var year=value.match(/c[+-].*/)?drawYear+parseInt(value.substring(1),10):value.match(/[+-].*/)?thisYear+parseInt(value,10):parseInt(value,10);return isNaN(year)?thisYear:year};var year=determineYear(years[0]);var endYear=Math.max(year,determineYear(years[1]||""));year=minDate?Math.max(year,minDate.getFullYear()):year;endYear=maxDate?Math.min(endYear,maxDate.getFullYear()):endYear;inst.yearshtml+='<select class="ui-datepicker-year" '+'onchange="DP_jQuery_'+dpuuid+".datepicker._selectMonthYear('#"+inst.id+"', this, 'Y');\" "+'onclick="DP_jQuery_'+dpuuid+".datepicker._clickMonthYear('#"+inst.id+"');\""+">";for(;year<=endYear;year++){inst.yearshtml+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"}inst.yearshtml+="</select>";if(!$.browser.mozilla){html+=inst.yearshtml;inst.yearshtml=null}else{html+='<select class="ui-datepicker-year"><option value="'+drawYear+'" selected="selected">'+drawYear+"</option></select>"}}}html+=this._get(inst,"yearSuffix");if(showMonthAfterYear)html+=(secondary||!(changeMonth&&changeYear)?" ":"")+monthHtml;html+="</div>";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._restrictMinMax(inst,this._daylightSavingAdjust(new Date(year,month,day)));inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y")this._notifyChange(inst)},_restrictMinMax:function(inst,date){var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");var newDate=minDate&&date<minDate?minDate:date;newDate=maxDate&&newDate>maxDate?maxDate:newDate;return newDate},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange)onChange.apply(inst.input?inst.input[0]:null,[inst.selectedYear,inst.selectedMonth+1,inst])},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return numMonths==null?[1,1]:typeof numMonths=="number"?[1,numMonths]:numMonths},_getMinMaxDate:function(inst,minMax){return this._determineDate(inst,this._get(inst,minMax+"Date"),null)},_getDaysInMonth:function(year,month){return 32-this._daylightSavingAdjust(new Date(year,month,32)).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[0]*numMonths[1]),1));if(offset<0)date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()));return this._isInRange(inst,date)},_isInRange:function(inst,date){var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return(!minDate||date.getTime()>=minDate.getTime())&&(!maxDate||date.getTime()<=maxDate.getTime())},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=typeof shortYearCutoff!="string"?shortYearCutoff:(new Date).getFullYear()%100+parseInt(shortYearCutoff,10);return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=day?typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day)):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props)if(props[name]==null||props[name]==undefined)target[name]=props[name];return target}function isArray(a){return a&&($.browser.safari&&typeof a=="object"&&a.length||a.constructor&&a.constructor.toString().match(/\Array\(\)/))}$.fn.datepicker=function(options){if(!this.length){return this}if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate"||options=="widget"))return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs));if(options=="option"&&arguments.length==2&&typeof arguments[1]=="string")return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs));return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker;$.datepicker.initialized=false;$.datepicker.uuid=(new Date).getTime();$.datepicker.version="1.8.12";window["DP_jQuery_"+dpuuid]=$})(jQuery);(function($,undefined){var uiDialogClasses="ui-dialog "+"ui-widget "+"ui-widget-content "+"ui-corner-all ",sizeRelatedOptions={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},resizableRelatedOptions={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},attrFn=$.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};$.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:{my:"center",at:"center",collision:"fit",using:function(pos){var topOffset=$(this).css(pos).offset().top;if(topOffset<0){$(this).css("top",pos.top-topOffset)}}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1e3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string"){this.originalTitle=""}this.options.title=this.options.title||this.originalTitle;var self=this,options=self.options,title=options.title||" ",titleId=$.ui.dialog.getTitleId(self.element),uiDialog=(self.uiDialog=$("<div></div>")).appendTo(document.body).hide().addClass(uiDialogClasses+options.dialogClass).css({zIndex:options.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(event){if(options.closeOnEscape&&event.keyCode&&event.keyCode===$.ui.keyCode.ESCAPE){self.close(event);event.preventDefault()}}).attr({role:"dialog","aria-labelledby":titleId}).mousedown(function(event){self.moveToTop(false,event)}),uiDialogContent=self.element.show().removeAttr("title").addClass("ui-dialog-content "+"ui-widget-content").appendTo(uiDialog),uiDialogTitlebar=(self.uiDialogTitlebar=$("<div></div>")).addClass("ui-dialog-titlebar "+"ui-widget-header "+"ui-corner-all "+"ui-helper-clearfix").prependTo(uiDialog),uiDialogTitlebarClose=$('<a href="#"></a>').addClass("ui-dialog-titlebar-close "+"ui-corner-all").attr("role","button").hover(function(){uiDialogTitlebarClose.addClass("ui-state-hover")},function(){uiDialogTitlebarClose.removeClass("ui-state-hover")}).focus(function(){uiDialogTitlebarClose.addClass("ui-state-focus")}).blur(function(){uiDialogTitlebarClose.removeClass("ui-state-focus")}).click(function(event){self.close(event);return false}).appendTo(uiDialogTitlebar),uiDialogTitlebarCloseText=(self.uiDialogTitlebarCloseText=$("<span></span>")).addClass("ui-icon "+"ui-icon-closethick").text(options.closeText).appendTo(uiDialogTitlebarClose),uiDialogTitle=$("<span></span>").addClass("ui-dialog-title").attr("id",titleId).html(title).prependTo(uiDialogTitlebar);if($.isFunction(options.beforeclose)&&!$.isFunction(options.beforeClose)){options.beforeClose=options.beforeclose}uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();if(options.draggable&&$.fn.draggable){self._makeDraggable()}if(options.resizable&&$.fn.resizable){self._makeResizable()}self._createButtons(options.buttons);self._isOpen=false;if($.fn.bgiframe){uiDialog.bgiframe()}},_init:function(){if(this.options.autoOpen){this.open()}},destroy:function(){var self=this;if(self.overlay){self.overlay.destroy()}self.uiDialog.hide();self.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");self.uiDialog.remove();if(self.originalTitle){self.element.attr("title",self.originalTitle)}return self},widget:function(){return this.uiDialog},close:function(event){var self=this,maxZ,thisZ;if(false===self._trigger("beforeClose",event)){return}if(self.overlay){self.overlay.destroy()}self.uiDialog.unbind("keypress.ui-dialog");self._isOpen=false;if(self.options.hide){self.uiDialog.hide(self.options.hide,function(){self._trigger("close",event)})}else{self.uiDialog.hide();self._trigger("close",event)}$.ui.dialog.overlay.resize();if(self.options.modal){maxZ=0;$(".ui-dialog").each(function(){if(this!==self.uiDialog[0]){thisZ=$(this).css("z-index");if(!isNaN(thisZ)){maxZ=Math.max(maxZ,thisZ)}}});$.ui.dialog.maxZ=maxZ}return self},isOpen:function(){return this._isOpen},moveToTop:function(force,event){var self=this,options=self.options,saveScroll;if(options.modal&&!force||!options.stack&&!options.modal){return self._trigger("focus",event)}if(options.zIndex>$.ui.dialog.maxZ){$.ui.dialog.maxZ=options.zIndex}if(self.overlay){$.ui.dialog.maxZ+=1;self.overlay.$el.css("z-index",$.ui.dialog.overlay.maxZ=$.ui.dialog.maxZ)}saveScroll={scrollTop:self.element.attr("scrollTop"),scrollLeft:self.element.attr("scrollLeft")};$.ui.dialog.maxZ+=1;self.uiDialog.css("z-index",$.ui.dialog.maxZ);self.element.attr(saveScroll);self._trigger("focus",event);return self},open:function(){if(this._isOpen){return}var self=this,options=self.options,uiDialog=self.uiDialog;self.overlay=options.modal?new $.ui.dialog.overlay(self):null;self._size();self._position(options.position);uiDialog.show(options.show);self.moveToTop(true);if(options.modal){uiDialog.bind("keypress.ui-dialog",function(event){if(event.keyCode!==$.ui.keyCode.TAB){return}var tabbables=$(":tabbable",this),first=tabbables.filter(":first"),last=tabbables.filter(":last");if(event.target===last[0]&&!event.shiftKey){first.focus(1);return false}else if(event.target===first[0]&&event.shiftKey){last.focus(1);return false}})}$(self.element.find(":tabbable").get().concat(uiDialog.find(".ui-dialog-buttonpane :tabbable").get().concat(uiDialog.get()))).eq(0).focus();self._isOpen=true;self._trigger("open");return self},_createButtons:function(buttons){var self=this,hasButtons=false,uiDialogButtonPane=$("<div></div>").addClass("ui-dialog-buttonpane "+"ui-widget-content "+"ui-helper-clearfix"),uiButtonSet=$("<div></div>").addClass("ui-dialog-buttonset").appendTo(uiDialogButtonPane);self.uiDialog.find(".ui-dialog-buttonpane").remove();if(typeof buttons==="object"&&buttons!==null){$.each(buttons,function(){return!(hasButtons=true)})}if(hasButtons){$.each(buttons,function(name,props){props=$.isFunction(props)?{click:props,text:name}:props;var button=$('<button type="button"></button>').click(function(){props.click.apply(self.element[0],arguments)}).appendTo(uiButtonSet);$.each(props,function(key,value){if(key==="click"){return}if(key in attrFn){button[key](value)}else{button.attr(key,value)}});if($.fn.button){button.button()}});uiDialogButtonPane.appendTo(self.uiDialog)}},_makeDraggable:function(){var self=this,options=self.options,doc=$(document),heightBeforeDrag;function filteredUi(ui){return{position:ui.position,offset:ui.offset}}self.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(event,ui){heightBeforeDrag=options.height==="auto"?"auto":$(this).height();$(this).height($(this).height()).addClass("ui-dialog-dragging");self._trigger("dragStart",event,filteredUi(ui))},drag:function(event,ui){self._trigger("drag",event,filteredUi(ui))},stop:function(event,ui){options.position=[ui.position.left-doc.scrollLeft(),ui.position.top-doc.scrollTop()];$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);self._trigger("dragStop",event,filteredUi(ui));$.ui.dialog.overlay.resize()}})},_makeResizable:function(handles){handles=handles===undefined?this.options.resizable:handles;var self=this,options=self.options,position=self.uiDialog.css("position"),resizeHandles=typeof handles==="string"?handles:"n,e,s,w,se,sw,ne,nw";function filteredUi(ui){return{originalPosition:ui.originalPosition,originalSize:ui.originalSize,position:ui.position,size:ui.size}}self.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:self.element,maxWidth:options.maxWidth,maxHeight:options.maxHeight,minWidth:options.minWidth,minHeight:self._minHeight(),handles:resizeHandles,start:function(event,ui){$(this).addClass("ui-dialog-resizing");self._trigger("resizeStart",event,filteredUi(ui))},resize:function(event,ui){self._trigger("resize",event,filteredUi(ui))},stop:function(event,ui){$(this).removeClass("ui-dialog-resizing");options.height=$(this).height();options.width=$(this).width();self._trigger("resizeStop",event,filteredUi(ui));$.ui.dialog.overlay.resize()}}).css("position",position).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var options=this.options;if(options.height==="auto"){return options.minHeight}else{return Math.min(options.minHeight,options.height)}},_position:function(position){var myAt=[],offset=[0,0],isVisible;if(position){if(typeof position==="string"||typeof position==="object"&&"0"in position){myAt=position.split?position.split(" "):[position[0],position[1]];if(myAt.length===1){myAt[1]=myAt[0]}$.each(["left","top"],function(i,offsetPosition){if(+myAt[i]===myAt[i]){offset[i]=myAt[i];myAt[i]=offsetPosition}});position={my:myAt.join(" "),at:myAt.join(" "),offset:offset.join(" ")}}position=$.extend({},$.ui.dialog.prototype.options.position,position)}else{position=$.ui.dialog.prototype.options.position}isVisible=this.uiDialog.is(":visible");if(!isVisible){this.uiDialog.show()}this.uiDialog.css({top:0,left:0}).position($.extend({of:window},position));if(!isVisible){this.uiDialog.hide()}},_setOptions:function(options){var self=this,resizableOptions={},resize=false;$.each(options,function(key,value){self._setOption(key,value);if(key in sizeRelatedOptions){resize=true}if(key in resizableRelatedOptions){resizableOptions[key]=value}});if(resize){this._size()}if(this.uiDialog.is(":data(resizable)")){this.uiDialog.resizable("option",resizableOptions)}},_setOption:function(key,value){var self=this,uiDialog=self.uiDialog;switch(key){case"beforeclose":key="beforeClose";break;case"buttons":self._createButtons(value);break;case"closeText":self.uiDialogTitlebarCloseText.text(""+value);break;case"dialogClass":uiDialog.removeClass(self.options.dialogClass).addClass(uiDialogClasses+value);break;case"disabled":if(value){uiDialog.addClass("ui-dialog-disabled")}else{uiDialog.removeClass("ui-dialog-disabled")}break;case"draggable":var isDraggable=uiDialog.is(":data(draggable)");if(isDraggable&&!value){uiDialog.draggable("destroy")}if(!isDraggable&&value){self._makeDraggable()}break;case"position":self._position(value);break;case"resizable":var isResizable=uiDialog.is(":data(resizable)");if(isResizable&&!value){uiDialog.resizable("destroy")}if(isResizable&&typeof value==="string"){uiDialog.resizable("option","handles",value)}if(!isResizable&&value!==false){self._makeResizable(value)}break;case"title":$(".ui-dialog-title",self.uiDialogTitlebar).html(""+(value||" "));break}$.Widget.prototype._setOption.apply(self,arguments)},_size:function(){var options=this.options,nonContentHeight,minContentHeight,isVisible=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(options.minWidth>options.width){options.width=options.minWidth}nonContentHeight=this.uiDialog.css({height:"auto",width:options.width}).height();minContentHeight=Math.max(0,options.minHeight-nonContentHeight);if(options.height==="auto"){if($.support.minHeight){this.element.css({minHeight:minContentHeight,height:"auto"})}else{this.uiDialog.show();var autoHeight=this.element.css("height","auto").height();if(!isVisible){this.uiDialog.hide()}this.element.height(Math.max(autoHeight,minContentHeight))}}else{this.element.height(Math.max(options.height-nonContentHeight,0))}if(this.uiDialog.is(":data(resizable)")){this.uiDialog.resizable("option","minHeight",this._minHeight())}}});$.extend($.ui.dialog,{version:"1.8.12",uuid:0,maxZ:0,getTitleId:function($el){var id=$el.attr("id");if(!id){this.uuid+=1;id=this.uuid}return"ui-dialog-title-"+id},overlay:function(dialog){this.$el=$.ui.dialog.overlay.create(dialog)}});$.extend($.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:$.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(event){return event+".dialog-overlay"}).join(" "),create:function(dialog){if(this.instances.length===0){setTimeout(function(){if($.ui.dialog.overlay.instances.length){$(document).bind($.ui.dialog.overlay.events,function(event){if($(event.target).zIndex()<$.ui.dialog.overlay.maxZ){return false}})}},1);$(document).bind("keydown.dialog-overlay",function(event){if(dialog.options.closeOnEscape&&event.keyCode&&event.keyCode===$.ui.keyCode.ESCAPE){dialog.close(event);event.preventDefault()}});$(window).bind("resize.dialog-overlay",$.ui.dialog.overlay.resize)}var $el=(this.oldInstances.pop()||$("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});if($.fn.bgiframe){$el.bgiframe()}this.instances.push($el);return $el},destroy:function($el){var indexOf=$.inArray($el,this.instances);if(indexOf!=-1){this.oldInstances.push(this.instances.splice(indexOf,1)[0])}if(this.instances.length===0){$([document,window]).unbind(".dialog-overlay")}$el.remove();var maxZ=0;$.each(this.instances,function(){maxZ=Math.max(maxZ,this.css("z-index"))});this.maxZ=maxZ},height:function(){var scrollHeight,offsetHeight;if($.browser.msie&&$.browser.version<7){scrollHeight=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);offsetHeight=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(scrollHeight<offsetHeight){return $(window).height()+"px"}else{return scrollHeight+"px"}}else{return $(document).height()+"px"}},width:function(){var scrollWidth,offsetWidth;if($.browser.msie&&$.browser.version<7){scrollWidth=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);offsetWidth=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(scrollWidth<offsetWidth){return $(window).width()+"px"}else{return scrollWidth+"px"}}else{return $(document).width()+"px"}},resize:function(){var $overlays=$([]);$.each($.ui.dialog.overlay.instances,function(){$overlays=$overlays.add(this)});$overlays.css({width:0,height:0}).css({width:$.ui.dialog.overlay.width(),height:$.ui.dialog.overlay.height()})}});$.extend($.ui.dialog.overlay.prototype,{destroy:function(){$.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);(function($,undefined){$.ui=$.ui||{};var horizontalPositions=/left|center|right/,verticalPositions=/top|center|bottom/,center="center",_position=$.fn.position,_offset=$.fn.offset;$.fn.position=function(options){if(!options||!options.of){return _position.apply(this,arguments)}options=$.extend({},options);var target=$(options.of),targetElem=target[0],collision=(options.collision||"flip").split(" "),offset=options.offset?options.offset.split(" "):[0,0],targetWidth,targetHeight,basePosition;if(targetElem.nodeType===9){targetWidth=target.width();targetHeight=target.height();basePosition={top:0,left:0}}else if(targetElem.setTimeout){targetWidth=target.width();targetHeight=target.height();basePosition={top:target.scrollTop(),left:target.scrollLeft()}}else if(targetElem.preventDefault){options.at="left top";targetWidth=targetHeight=0;basePosition={top:options.of.pageY,left:options.of.pageX}}else{targetWidth=target.outerWidth();targetHeight=target.outerHeight();basePosition=target.offset()}$.each(["my","at"],function(){var pos=(options[this]||"").split(" ");if(pos.length===1){pos=horizontalPositions.test(pos[0])?pos.concat([center]):verticalPositions.test(pos[0])?[center].concat(pos):[center,center]}pos[0]=horizontalPositions.test(pos[0])?pos[0]:center;pos[1]=verticalPositions.test(pos[1])?pos[1]:center;options[this]=pos});if(collision.length===1){collision[1]=collision[0]}offset[0]=parseInt(offset[0],10)||0;if(offset.length===1){offset[1]=offset[0]}offset[1]=parseInt(offset[1],10)||0;if(options.at[0]==="right"){basePosition.left+=targetWidth}else if(options.at[0]===center){basePosition.left+=targetWidth/2}if(options.at[1]==="bottom"){basePosition.top+=targetHeight}else if(options.at[1]===center){basePosition.top+=targetHeight/2}basePosition.left+=offset[0];basePosition.top+=offset[1];return this.each(function(){var elem=$(this),elemWidth=elem.outerWidth(),elemHeight=elem.outerHeight(),marginLeft=parseInt($.curCSS(this,"marginLeft",true))||0,marginTop=parseInt($.curCSS(this,"marginTop",true))||0,collisionWidth=elemWidth+marginLeft+(parseInt($.curCSS(this,"marginRight",true))||0),collisionHeight=elemHeight+marginTop+(parseInt($.curCSS(this,"marginBottom",true))||0),position=$.extend({},basePosition),collisionPosition;if(options.my[0]==="right"){position.left-=elemWidth}else if(options.my[0]===center){position.left-=elemWidth/2}if(options.my[1]==="bottom"){position.top-=elemHeight}else if(options.my[1]===center){position.top-=elemHeight/2}position.left=Math.round(position.left);position.top=Math.round(position.top);collisionPosition={left:position.left-marginLeft,top:position.top-marginTop};$.each(["left","top"],function(i,dir){if($.ui.position[collision[i]]){$.ui.position[collision[i]][dir](position,{targetWidth:targetWidth,targetHeight:targetHeight,elemWidth:elemWidth,elemHeight:elemHeight,collisionPosition:collisionPosition,collisionWidth:collisionWidth,collisionHeight:collisionHeight,offset:offset,my:options.my,at:options.at})}});if($.fn.bgiframe){elem.bgiframe()}elem.offset($.extend(position,{using:options.using}))})};$.ui.position={fit:{left:function(position,data){var win=$(window),over=data.collisionPosition.left+data.collisionWidth-win.width()-win.scrollLeft();position.left=over>0?position.left-over:Math.max(position.left-data.collisionPosition.left,position.left)},top:function(position,data){var win=$(window),over=data.collisionPosition.top+data.collisionHeight-win.height()-win.scrollTop();position.top=over>0?position.top-over:Math.max(position.top-data.collisionPosition.top,position.top)}},flip:{left:function(position,data){if(data.at[0]===center){return}var win=$(window),over=data.collisionPosition.left+data.collisionWidth-win.width()-win.scrollLeft(),myOffset=data.my[0]==="left"?-data.elemWidth:data.my[0]==="right"?data.elemWidth:0,atOffset=data.at[0]==="left"?data.targetWidth:-data.targetWidth,offset=-2*data.offset[0];position.left+=data.collisionPosition.left<0?myOffset+atOffset+offset:over>0?myOffset+atOffset+offset:0},top:function(position,data){if(data.at[1]===center){return}var win=$(window),over=data.collisionPosition.top+data.collisionHeight-win.height()-win.scrollTop(),myOffset=data.my[1]==="top"?-data.elemHeight:data.my[1]==="bottom"?data.elemHeight:0,atOffset=data.at[1]==="top"?data.targetHeight:-data.targetHeight,offset=-2*data.offset[1];position.top+=data.collisionPosition.top<0?myOffset+atOffset+offset:over>0?myOffset+atOffset+offset:0}}};if(!$.offset.setOffset){$.offset.setOffset=function(elem,options){if(/static/.test($.curCSS(elem,"position"))){elem.style.position="relative"}var curElem=$(elem),curOffset=curElem.offset(),curTop=parseInt($.curCSS(elem,"top",true),10)||0,curLeft=parseInt($.curCSS(elem,"left",true),10)||0,props={top:options.top-curOffset.top+curTop,left:options.left-curOffset.left+curLeft};if("using"in options){options.using.call(elem,props)}else{curElem.css(props)}};$.fn.offset=function(options){var elem=this[0];if(!elem||!elem.ownerDocument){return null}if(options){return this.each(function(){$.offset.setOffset(this,options)})}return _offset.call(this)}}})(jQuery);(function($,undefined){$.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=$("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");this.valueDiv.remove();$.Widget.prototype.destroy.apply(this,arguments)},value:function(newValue){if(newValue===undefined){return this._value()}this._setOption("value",newValue);return this},_setOption:function(key,value){if(key==="value"){this.options.value=value;this._refreshValue();if(this._value()===this.options.max){this._trigger("complete")}}$.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var val=this.options.value;if(typeof val!=="number"){val=0}return Math.min(this.options.max,Math.max(this.min,val))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var value=this.value();var percentage=this._percentage();if(this.oldValue!==value){this.oldValue=value;this._trigger("change")}this.valueDiv.toggle(value>this.min).toggleClass("ui-corner-right",value===this.options.max).width(percentage.toFixed(0)+"%");this.element.attr("aria-valuenow",value)}});$.extend($.ui.progressbar,{version:"1.8.12"})})(jQuery);(function($,undefined){var numPages=5;$.widget("ui.slider",$.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var self=this,o=this.options;this._keySliding=false;this._mouseSliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider"+" ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all");if(o.disabled){this.element.addClass("ui-slider-disabled ui-disabled")}this.range=$([]);if(o.range){if(o.range===true){this.range=$("<div></div>");if(!o.values){o.values=[this._valueMin(),this._valueMin()]}if(o.values.length&&o.values.length!==2){o.values=[o.values[0],o.values[0]]}}else{this.range=$("<div></div>")}this.range.appendTo(this.element).addClass("ui-slider-range");if(o.range==="min"||o.range==="max"){this.range.addClass("ui-slider-range-"+o.range)}this.range.addClass("ui-widget-header")}if($(".ui-slider-handle",this.element).length===0){$("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle")}if(o.values&&o.values.length){while($(".ui-slider-handle",this.element).length<o.values.length){$("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle")}}this.handles=$(".ui-slider-handle",this.element).addClass("ui-state-default"+" ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(event){event.preventDefault()}).hover(function(){if(!o.disabled){$(this).addClass("ui-state-hover")}},function(){$(this).removeClass("ui-state-hover")}).focus(function(){if(!o.disabled){$(".ui-slider .ui-state-focus").removeClass("ui-state-focus");$(this).addClass("ui-state-focus")}else{$(this).blur()}}).blur(function(){$(this).removeClass("ui-state-focus")});this.handles.each(function(i){$(this).data("index.ui-slider-handle",i)});this.handles.keydown(function(event){var ret=true,index=$(this).data("index.ui-slider-handle"),allowed,curVal,newVal,step;if(self.options.disabled){return}switch(event.keyCode){case $.ui.keyCode.HOME:case $.ui.keyCode.END:case $.ui.keyCode.PAGE_UP:case $.ui.keyCode.PAGE_DOWN:case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:ret=false;if(!self._keySliding){self._keySliding=true;$(this).addClass("ui-state-active");allowed=self._start(event,index);if(allowed===false){return}}break}step=self.options.step;if(self.options.values&&self.options.values.length){curVal=newVal=self.values(index)}else{curVal=newVal=self.value()}switch(event.keyCode){case $.ui.keyCode.HOME:newVal=self._valueMin();break;case $.ui.keyCode.END:newVal=self._valueMax();break;case $.ui.keyCode.PAGE_UP:newVal=self._trimAlignValue(curVal+(self._valueMax()-self._valueMin())/numPages);break;case $.ui.keyCode.PAGE_DOWN:newVal=self._trimAlignValue(curVal-(self._valueMax()-self._valueMin())/numPages);break;case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:if(curVal===self._valueMax()){return}newVal=self._trimAlignValue(curVal+step);break;case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:if(curVal===self._valueMin()){return}newVal=self._trimAlignValue(curVal-step);break}self._slide(event,index,newVal);return ret}).keyup(function(event){var index=$(this).data("index.ui-slider-handle");if(self._keySliding){self._keySliding=false;self._stop(event,index);self._change(event,index);$(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider"+" ui-slider-horizontal"+" ui-slider-vertical"+" ui-slider-disabled"+" ui-widget"+" ui-widget-content"+" ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy();return this},_mouseCapture:function(event){var o=this.options,position,normValue,distance,closestHandle,self,index,allowed,offset,mouseOverHandle;if(o.disabled){return false}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()
};this.elementOffset=this.element.offset();position={x:event.pageX,y:event.pageY};normValue=this._normValueFromMouse(position);distance=this._valueMax()-this._valueMin()+1;self=this;this.handles.each(function(i){var thisDistance=Math.abs(normValue-self.values(i));if(distance>thisDistance){distance=thisDistance;closestHandle=$(this);index=i}});if(o.range===true&&this.values(1)===o.min){index+=1;closestHandle=$(this.handles[index])}allowed=this._start(event,index);if(allowed===false){return false}this._mouseSliding=true;self._handleIndex=index;closestHandle.addClass("ui-state-active").focus();offset=closestHandle.offset();mouseOverHandle=!$(event.target).parents().andSelf().is(".ui-slider-handle");this._clickOffset=mouseOverHandle?{left:0,top:0}:{left:event.pageX-offset.left-closestHandle.width()/2,top:event.pageY-offset.top-closestHandle.height()/2-(parseInt(closestHandle.css("borderTopWidth"),10)||0)-(parseInt(closestHandle.css("borderBottomWidth"),10)||0)+(parseInt(closestHandle.css("marginTop"),10)||0)};if(!this.handles.hasClass("ui-state-hover")){this._slide(event,index,normValue)}this._animateOff=true;return true},_mouseStart:function(event){return true},_mouseDrag:function(event){var position={x:event.pageX,y:event.pageY},normValue=this._normValueFromMouse(position);this._slide(event,this._handleIndex,normValue);return false},_mouseStop:function(event){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(event,this._handleIndex);this._change(event,this._handleIndex);this._handleIndex=null;this._clickOffset=null;this._animateOff=false;return false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(position){var pixelTotal,pixelMouse,percentMouse,valueTotal,valueMouse;if(this.orientation==="horizontal"){pixelTotal=this.elementSize.width;pixelMouse=position.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{pixelTotal=this.elementSize.height;pixelMouse=position.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}percentMouse=pixelMouse/pixelTotal;if(percentMouse>1){percentMouse=1}if(percentMouse<0){percentMouse=0}if(this.orientation==="vertical"){percentMouse=1-percentMouse}valueTotal=this._valueMax()-this._valueMin();valueMouse=this._valueMin()+percentMouse*valueTotal;return this._trimAlignValue(valueMouse)},_start:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values()}return this._trigger("start",event,uiHash)},_slide:function(event,index,newVal){var otherVal,newValues,allowed;if(this.options.values&&this.options.values.length){otherVal=this.values(index?0:1);if(this.options.values.length===2&&this.options.range===true&&(index===0&&newVal>otherVal||index===1&&newVal<otherVal)){newVal=otherVal}if(newVal!==this.values(index)){newValues=this.values();newValues[index]=newVal;allowed=this._trigger("slide",event,{handle:this.handles[index],value:newVal,values:newValues});otherVal=this.values(index?0:1);if(allowed!==false){this.values(index,newVal,true)}}}else{if(newVal!==this.value()){allowed=this._trigger("slide",event,{handle:this.handles[index],value:newVal});if(allowed!==false){this.value(newVal)}}}},_stop:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values()}this._trigger("stop",event,uiHash)},_change:function(event,index){if(!this._keySliding&&!this._mouseSliding){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values()}this._trigger("change",event,uiHash)}},value:function(newValue){if(arguments.length){this.options.value=this._trimAlignValue(newValue);this._refreshValue();this._change(null,0);return}return this._value()},values:function(index,newValue){var vals,newValues,i;if(arguments.length>1){this.options.values[index]=this._trimAlignValue(newValue);this._refreshValue();this._change(null,index);return}if(arguments.length){if($.isArray(arguments[0])){vals=this.options.values;newValues=arguments[0];for(i=0;i<vals.length;i+=1){vals[i]=this._trimAlignValue(newValues[i]);this._change(null,i)}this._refreshValue()}else{if(this.options.values&&this.options.values.length){return this._values(index)}else{return this.value()}}}else{return this._values()}},_setOption:function(key,value){var i,valsLength=0;if($.isArray(this.options.values)){valsLength=this.options.values.length}$.Widget.prototype._setOption.apply(this,arguments);switch(key){case"disabled":if(value){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.attr("disabled","disabled");this.element.addClass("ui-disabled")}else{this.handles.removeAttr("disabled");this.element.removeClass("ui-disabled")}break;case"orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case"value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case"values":this._animateOff=true;this._refreshValue();for(i=0;i<valsLength;i+=1){this._change(null,i)}this._animateOff=false;break}},_value:function(){var val=this.options.value;val=this._trimAlignValue(val);return val},_values:function(index){var val,vals,i;if(arguments.length){val=this.options.values[index];val=this._trimAlignValue(val);return val}else{vals=this.options.values.slice();for(i=0;i<vals.length;i+=1){vals[i]=this._trimAlignValue(vals[i])}return vals}},_trimAlignValue:function(val){if(val<=this._valueMin()){return this._valueMin()}if(val>=this._valueMax()){return this._valueMax()}var step=this.options.step>0?this.options.step:1,valModStep=(val-this._valueMin())%step;alignValue=val-valModStep;if(Math.abs(valModStep)*2>=step){alignValue+=valModStep>0?step:-step}return parseFloat(alignValue.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var oRange=this.options.range,o=this.options,self=this,animate=!this._animateOff?o.animate:false,valPercent,_set={},lastValPercent,value,valueMin,valueMax;if(this.options.values&&this.options.values.length){this.handles.each(function(i,j){valPercent=(self.values(i)-self._valueMin())/(self._valueMax()-self._valueMin())*100;_set[self.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";$(this).stop(1,1)[animate?"animate":"css"](_set,o.animate);if(self.options.range===true){if(self.orientation==="horizontal"){if(i===0){self.range.stop(1,1)[animate?"animate":"css"]({left:valPercent+"%"},o.animate)}if(i===1){self.range[animate?"animate":"css"]({width:valPercent-lastValPercent+"%"},{queue:false,duration:o.animate})}}else{if(i===0){self.range.stop(1,1)[animate?"animate":"css"]({bottom:valPercent+"%"},o.animate)}if(i===1){self.range[animate?"animate":"css"]({height:valPercent-lastValPercent+"%"},{queue:false,duration:o.animate})}}}lastValPercent=valPercent})}else{value=this.value();valueMin=this._valueMin();valueMax=this._valueMax();valPercent=valueMax!==valueMin?(value-valueMin)/(valueMax-valueMin)*100:0;_set[self.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";this.handle.stop(1,1)[animate?"animate":"css"](_set,o.animate);if(oRange==="min"&&this.orientation==="horizontal"){this.range.stop(1,1)[animate?"animate":"css"]({width:valPercent+"%"},o.animate)}if(oRange==="max"&&this.orientation==="horizontal"){this.range[animate?"animate":"css"]({width:100-valPercent+"%"},{queue:false,duration:o.animate})}if(oRange==="min"&&this.orientation==="vertical"){this.range.stop(1,1)[animate?"animate":"css"]({height:valPercent+"%"},o.animate)}if(oRange==="max"&&this.orientation==="vertical"){this.range[animate?"animate":"css"]({height:100-valPercent+"%"},{queue:false,duration:o.animate})}}}});$.extend($.ui.slider,{version:"1.8.12"})})(jQuery);(function($,undefined){var tabId=0,listId=0;function getNextTabId(){return++tabId}function getNextListId(){return++listId}$.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading…</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(true)},_setOption:function(key,value){if(key=="selected"){if(this.options.collapsible&&value==this.options.selected){return}this.select(value)}else{this.options[key]=value;this._tabify()}},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+getNextTabId()},_sanitizeSelector:function(hash){return hash.replace(/:/g,"\\:")},_cookie:function(){var cookie=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+getNextListId());return $.cookie.apply(null,[cookie].concat($.makeArray(arguments)))},_ui:function(tab,panel){return{tab:tab,panel:panel,index:this.anchors.index(tab)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var el=$(this);el.html(el.data("label.tabs")).removeData("label.tabs")})},_tabify:function(init){var self=this,o=this.options,fragmentId=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=$(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return $("a",this)[0]});this.panels=$([]);this.anchors.each(function(i,a){var href=$(a).attr("href");var hrefBase=href.split("#")[0],baseEl;if(hrefBase&&(hrefBase===location.toString().split("#")[0]||(baseEl=$("base")[0])&&hrefBase===baseEl.href)){href=a.hash;a.href=href}if(fragmentId.test(href)){self.panels=self.panels.add(self.element.find(self._sanitizeSelector(href)))}else if(href&&href!=="#"){$.data(a,"href.tabs",href);$.data(a,"load.tabs",href.replace(/#.*$/,""));var id=self._tabId(a);a.href="#"+id;var $panel=self.element.find("#"+id);if(!$panel.length){$panel=$(o.panelTemplate).attr("id",id).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(self.panels[i-1]||self.list);$panel.data("destroy.tabs",true)}self.panels=self.panels.add($panel)}else{o.disabled.push(i)}});if(init){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(o.selected===undefined){if(location.hash){this.anchors.each(function(i,a){if(a.hash==location.hash){o.selected=i;return false}})}if(typeof o.selected!=="number"&&o.cookie){o.selected=parseInt(self._cookie(),10)}if(typeof o.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length){o.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}o.selected=o.selected||(this.lis.length?0:-1)}else if(o.selected===null){o.selected=-1}o.selected=o.selected>=0&&this.anchors[o.selected]||o.selected<0?o.selected:0;o.disabled=$.unique(o.disabled.concat($.map(this.lis.filter(".ui-state-disabled"),function(n,i){return self.lis.index(n)}))).sort();if($.inArray(o.selected,o.disabled)!=-1){o.disabled.splice($.inArray(o.selected,o.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(o.selected>=0&&this.anchors.length){self.element.find(self._sanitizeSelector(self.anchors[o.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(o.selected).addClass("ui-tabs-selected ui-state-active");self.element.queue("tabs",function(){self._trigger("show",null,self._ui(self.anchors[o.selected],self.element.find(self._sanitizeSelector(self.anchors[o.selected].hash))[0]))});this.load(o.selected)}$(window).bind("unload",function(){self.lis.add(self.anchors).unbind(".tabs");self.lis=self.anchors=self.panels=null})}else{o.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[o.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(o.cookie){this._cookie(o.selected,o.cookie)}for(var i=0,li;li=this.lis[i];i++){$(li)[$.inArray(i,o.disabled)!=-1&&!$(li).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(o.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(o.event!=="mouseover"){var addState=function(state,el){if(el.is(":not(.ui-state-disabled)")){el.addClass("ui-state-"+state)}};var removeState=function(state,el){el.removeClass("ui-state-"+state)};this.lis.bind("mouseover.tabs",function(){addState("hover",$(this))});this.lis.bind("mouseout.tabs",function(){removeState("hover",$(this))});this.anchors.bind("focus.tabs",function(){addState("focus",$(this).closest("li"))});this.anchors.bind("blur.tabs",function(){removeState("focus",$(this).closest("li"))})}var hideFx,showFx;if(o.fx){if($.isArray(o.fx)){hideFx=o.fx[0];showFx=o.fx[1]}else{hideFx=showFx=o.fx}}function resetStyle($el,fx){$el.css("display","");if(!$.support.opacity&&fx.opacity){$el[0].style.removeAttribute("filter")}}var showTab=showFx?function(clicked,$show){$(clicked).closest("li").addClass("ui-tabs-selected ui-state-active");$show.hide().removeClass("ui-tabs-hide").animate(showFx,showFx.duration||"normal",function(){resetStyle($show,showFx);self._trigger("show",null,self._ui(clicked,$show[0]))})}:function(clicked,$show){$(clicked).closest("li").addClass("ui-tabs-selected ui-state-active");$show.removeClass("ui-tabs-hide");self._trigger("show",null,self._ui(clicked,$show[0]))};var hideTab=hideFx?function(clicked,$hide){$hide.animate(hideFx,hideFx.duration||"normal",function(){self.lis.removeClass("ui-tabs-selected ui-state-active");$hide.addClass("ui-tabs-hide");resetStyle($hide,hideFx);self.element.dequeue("tabs")})}:function(clicked,$hide,$show){self.lis.removeClass("ui-tabs-selected ui-state-active");$hide.addClass("ui-tabs-hide");self.element.dequeue("tabs")};this.anchors.bind(o.event+".tabs",function(){var el=this,$li=$(el).closest("li"),$hide=self.panels.filter(":not(.ui-tabs-hide)"),$show=self.element.find(self._sanitizeSelector(el.hash));if($li.hasClass("ui-tabs-selected")&&!o.collapsible||$li.hasClass("ui-state-disabled")||$li.hasClass("ui-state-processing")||self.panels.filter(":animated").length||self._trigger("select",null,self._ui(this,$show[0]))===false){this.blur();return false}o.selected=self.anchors.index(this);self.abort();if(o.collapsible){if($li.hasClass("ui-tabs-selected")){o.selected=-1;if(o.cookie){self._cookie(o.selected,o.cookie)}self.element.queue("tabs",function(){hideTab(el,$hide)}).dequeue("tabs");this.blur();return false}else if(!$hide.length){if(o.cookie){self._cookie(o.selected,o.cookie)}self.element.queue("tabs",function(){showTab(el,$show)});self.load(self.anchors.index(this));this.blur();return false}}if(o.cookie){self._cookie(o.selected,o.cookie)}if($show.length){if($hide.length){self.element.queue("tabs",function(){hideTab(el,$hide)})}self.element.queue("tabs",function(){showTab(el,$show)});self.load(self.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if($.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(index){if(typeof index=="string"){index=this.anchors.index(this.anchors.filter("[href$="+index+"]"))}return index},destroy:function(){var o=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var href=$.data(this,"href.tabs");if(href){this.href=href}var $this=$(this).unbind(".tabs");$.each(["href","load","cache"],function(i,prefix){$this.removeData(prefix+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if($.data(this,"destroy.tabs")){$(this).remove()}else{$(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}});if(o.cookie){this._cookie(null,o.cookie)}return this},add:function(url,label,index){if(index===undefined){index=this.anchors.length}var self=this,o=this.options,$li=$(o.tabTemplate.replace(/#\{href\}/g,url).replace(/#\{label\}/g,label)),id=!url.indexOf("#")?url.replace("#",""):this._tabId($("a",$li)[0]);$li.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var $panel=self.element.find("#"+id);if(!$panel.length){$panel=$(o.panelTemplate).attr("id",id).data("destroy.tabs",true)}$panel.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(index>=this.lis.length){$li.appendTo(this.list);$panel.appendTo(this.list[0].parentNode)}else{$li.insertBefore(this.lis[index]);$panel.insertBefore(this.panels[index])}o.disabled=$.map(o.disabled,function(n,i){return n>=index?++n:n});this._tabify();if(this.anchors.length==1){o.selected=0;$li.addClass("ui-tabs-selected ui-state-active");$panel.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){self._trigger("show",null,self._ui(self.anchors[0],self.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[index],this.panels[index]));return this},remove:function(index){index=this._getIndex(index);var o=this.options,$li=this.lis.eq(index).remove(),$panel=this.panels.eq(index).remove();if($li.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(index+(index+1<this.anchors.length?1:-1))}o.disabled=$.map($.grep(o.disabled,function(n,i){return n!=index}),function(n,i){return n>=index?--n:n});this._tabify();this._trigger("remove",null,this._ui($li.find("a")[0],$panel[0]));return this},enable:function(index){index=this._getIndex(index);var o=this.options;if($.inArray(index,o.disabled)==-1){return}this.lis.eq(index).removeClass("ui-state-disabled");o.disabled=$.grep(o.disabled,function(n,i){return n!=index});this._trigger("enable",null,this._ui(this.anchors[index],this.panels[index]));return this},disable:function(index){index=this._getIndex(index);var self=this,o=this.options;if(index!=o.selected){this.lis.eq(index).addClass("ui-state-disabled");o.disabled.push(index);o.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[index],this.panels[index]))}return this},select:function(index){index=this._getIndex(index);if(index==-1){if(this.options.collapsible&&this.options.selected!=-1){index=this.options.selected}else{return this}}this.anchors.eq(index).trigger(this.options.event+".tabs");return this},load:function(index){index=this._getIndex(index);var self=this,o=this.options,a=this.anchors.eq(index)[0],url=$.data(a,"load.tabs");this.abort();if(!url||this.element.queue("tabs").length!==0&&$.data(a,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(index).addClass("ui-state-processing");if(o.spinner){var span=$("span",a);span.data("label.tabs",span.html()).html(o.spinner)}this.xhr=$.ajax($.extend({},o.ajaxOptions,{url:url,success:function(r,s){self.element.find(self._sanitizeSelector(a.hash)).html(r);self._cleanup();if(o.cache){$.data(a,"cache.tabs",true)}self._trigger("load",null,self._ui(self.anchors[index],self.panels[index]));try{o.ajaxOptions.success(r,s)}catch(e){}},error:function(xhr,s,e){self._cleanup();self._trigger("load",null,self._ui(self.anchors[index],self.panels[index]));try{o.ajaxOptions.error(xhr,s,index,a)}catch(e){}}}));self.element.dequeue("tabs");return this},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},url:function(index,url){this.anchors.eq(index).removeData("cache.tabs").data("load.tabs",url);return this},length:function(){return this.anchors.length}});$.extend($.ui.tabs,{version:"1.8.12"});$.extend($.ui.tabs.prototype,{rotation:null,rotate:function(ms,continuing){var self=this,o=this.options;var rotate=self._rotate||(self._rotate=function(e){clearTimeout(self.rotation);self.rotation=setTimeout(function(){var t=o.selected;self.select(++t<self.anchors.length?t:0)},ms);if(e){e.stopPropagation()}});var stop=self._unrotate||(self._unrotate=!continuing?function(e){if(e.clientX){self.rotate(null)}}:function(e){t=o.selected;rotate()});if(ms){this.element.bind("tabsshow",rotate);this.anchors.bind(o.event+".tabs",stop);rotate()}else{clearTimeout(self.rotation);this.element.unbind("tabsshow",rotate);this.anchors.unbind(o.event+".tabs",stop);delete this._rotate;delete this._unrotate}return this}})})(jQuery);(function($){var helper={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){$.tooltip.blocked=!$.tooltip.blocked}};$.fn.extend({tooltip:function(settings){settings=$.extend({},$.tooltip.defaults,settings);createHelper(settings);return this.each(function(){$.data(this,"tooltip",settings);this.tOpacity=helper.parent.css("opacity");this.tooltipText=this.title;$(this).removeAttr("title");this.alt=""}).mouseover(save).mouseout(hide).click(hide)},fixPNG:IE?function(){return this.each(function(){var image=$(this).css("backgroundImage");if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css("position");if(position!="absolute"&&position!="relative")$(this).css("position","relative")})}})}:function(){return this},unfixPNG:IE?function(){return this.each(function(){$(this).css({filter:"",backgroundImage:""})})}:function(){return this},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]()})},url:function(){return this.attr("href")||this.attr("src")}});function createHelper(settings){if(helper.parent)return;helper.parent=$('<div id="'+settings.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if($.fn.bgiframe)helper.parent.bgiframe();helper.title=$("h3",helper.parent);helper.body=$("div.body",helper.parent);helper.url=$("div.url",helper.parent)}function settings(element){return $.data(element,"tooltip")}function handle(event){if(settings(this).delay)tID=setTimeout(show,settings(this).delay);else show();track=!!settings(this).track;$(document.body).bind("mousemove",update);update(event)}function save(){if($.tooltip.blocked||this==current||!this.tooltipText&&!settings(this).bodyHandler)return;current=this;title=this.tooltipText;if(settings(this).bodyHandler){helper.title.hide();var bodyContent=settings(this).bodyHandler.call(this);if(bodyContent.nodeType||bodyContent.jquery){helper.body.empty().append(bodyContent)}else{helper.body.html(bodyContent)}helper.body.show()}else if(settings(this).showBody){var parts=title.split(settings(this).showBody);helper.title.html(parts.shift()).show();helper.body.empty();for(var i=0,part;part=parts[i];i++){if(i>0)helper.body.append("<br/>");helper.body.append(part)}helper.body.hideWhenEmpty()}else{helper.title.html(title).show();helper.body.hide()}if(settings(this).showURL&&$(this).url())helper.url.html($(this).url().replace("http://","")).show();else helper.url.hide();helper.parent.addClass(settings(this).extraClass);if(settings(this).fixPNG)helper.parent.fixPNG();handle.apply(this,arguments)}function show(){tID=null;if((!IE||!$.fn.bgiframe)&&settings(current).fade){if(helper.parent.is(":animated"))helper.parent.stop().show().fadeTo(settings(current).fade,current.tOpacity);else helper.parent.is(":visible")?helper.parent.fadeTo(settings(current).fade,current.tOpacity):helper.parent.fadeIn(settings(current).fade)}else{helper.parent.show()}update()}function update(event){if($.tooltip.blocked)return;if(event&&event.target.tagName=="OPTION"){return}if(!track&&helper.parent.is(":visible")){$(document.body).unbind("mousemove",update)}if(current==null){$(document.body).unbind("mousemove",update);return}helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+settings(current).left;top=event.pageY+settings(current).top;var right="auto";if(settings(current).positionLeft){right=$(window).width()-left;left="auto"}helper.parent.css({left:left,right:right,top:top})}var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+settings(current).left;helper.parent.css({left:left+"px"}).addClass("viewport-right")}if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+settings(current).top;helper.parent.css({top:top+"px"}).addClass("viewport-bottom")}}function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()}}function hide(event){if($.tooltip.blocked)return;if(tID)clearTimeout(tID);current=null;var tsettings=settings(this);function complete(){helper.parent.removeClass(tsettings.extraClass).hide().css("opacity","")}if((!IE||!$.fn.bgiframe)&&tsettings.fade){if(helper.parent.is(":animated"))helper.parent.stop().fadeTo(tsettings.fade,0,complete);else helper.parent.stop().fadeOut(tsettings.fade,complete)}else complete();if(settings(this).fixPNG)helper.parent.unfixPNG()}})(jQuery);(function(){var CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");Math.uuid=function(len,radix){var chars=CHARS,uuid=[],i;radix=radix||chars.length;if(len){for(i=0;i<len;i++)uuid[i]=chars[0|Math.random()*radix]}else{var r;uuid[8]=uuid[13]=uuid[18]=uuid[23]="-";uuid[14]="4";for(i=0;i<36;i++){if(!uuid[i]){r=0|Math.random()*16;uuid[i]=chars[i==19?r&3|8:r]}}}return uuid.join("")};Math.uuidFast=function(){var chars=CHARS,uuid=new Array(36),rnd=0,r;for(var i=0;i<36;i++){if(i==8||i==13||i==18||i==23){uuid[i]="-"}else if(i==14){uuid[i]="4"}else{if(rnd<=2)rnd=33554432+Math.random()*16777216|0;r=rnd&15;rnd=rnd>>4;uuid[i]=chars[i==19?r&3|8:r]}}return uuid.join("")};Math.uuidCompact=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=="x"?r:r&3|8;return v.toString(16)})}})();(function(global){var SETTIMEOUT=global.setTimeout,doc=global.document,callback_counter=0;global.jXHR=function(){var script_url,script_loaded,jsonp_callback,scriptElem,publicAPI=null;function removeScript(){try{scriptElem.parentNode.removeChild(scriptElem)}catch(err){}}function reset(){script_loaded=false;script_url="";removeScript();scriptElem=null;fireReadyStateChange(0)}function ThrowError(msg){try{publicAPI.onerror.call(publicAPI,msg,script_url)}catch(err){throw new Error(msg)}}function handleScriptLoad(){if(this.readyState&&this.readyState!=="complete"&&this.readyState!=="loaded"||script_loaded){return}this.onload=this.onreadystatechange=null;script_loaded=true;if(publicAPI.readyState!==4)ThrowError("Script failed to load ["+script_url+"].");removeScript()}function fireReadyStateChange(rs,args){args=args||[];publicAPI.readyState=rs;if(typeof publicAPI.onreadystatechange==="function")publicAPI.onreadystatechange.apply(publicAPI,args)}publicAPI={onerror:null,onreadystatechange:null,readyState:0,open:function(method,url){reset();internal_callback="cb"+callback_counter++;(function(icb){global.jXHR[icb]=function(){try{fireReadyStateChange.call(publicAPI,4,arguments)}catch(err){publicAPI.readyState=-1;ThrowError("Script failed to run ["+script_url+"].")}global.jXHR[icb]=null}})(internal_callback);script_url=url.replace(/=\?/,"=jXHR."+internal_callback);fireReadyStateChange(1)},send:function(){SETTIMEOUT(function(){scriptElem=doc.createElement("script");scriptElem.setAttribute("type","text/javascript");scriptElem.onload=scriptElem.onreadystatechange=function(){handleScriptLoad.call(scriptElem)};scriptElem.setAttribute("src",script_url);doc.getElementsByTagName("head")[0].appendChild(scriptElem)},0);fireReadyStateChange(2)},setRequestHeader:function(){},getResponseHeader:function(){return""},getAllResponseHeaders:function(){return[]}};reset();return publicAPI}})(window);function ThreeD(){POLYMESH=new Array;CENTERX=400;CENTERY=240;LIGHTX=-1e3;LIGHTY=-1e3;LIGHTZ=-1e3;ORIGINX=0;ORIGINY=0;ORIGINZ=0;ANGLEX=0;ANGLEY=0;ANGLEZ=0}ThreeD.prototype.setPoints=function(Points){POLYMESH=[];for(var value=Points.length;--value>=0;)POLYMESH[value]=Points[value].slice()};ThreeD.prototype.loadMesh=function(array){if(POLYMESH=array.split(";"))for(i=POLYMESH.length;--i>=0;)POLYMESH[i]=POLYMESH[i].split(",")};ThreeD.prototype.getPoints=function(){return POLYMESH};ThreeD.prototype.setCenter=function(x,y){CENTERX=x|0;CENTERY=y|0};ThreeD.prototype.setLight=function(x,y,z){LIGHTX=x|0;LIGHTY=y|0;LIGHTZ=z|0};ThreeD.prototype.explode=function(z){var x1,y1,z1,x2,y2,z2;var normali,normalj,normalk,magNormal;for(var value=POLYMESH.length;--value>=0;){x1=POLYMESH[value][3]-POLYMESH[value][0];y1=POLYMESH[value][4]-POLYMESH[value][1];z1=POLYMESH[value][5]-POLYMESH[value][2];x2=POLYMESH[value][6]-POLYMESH[value][0];y2=POLYMESH[value][7]-POLYMESH[value][1];z2=POLYMESH[value][8]-POLYMESH[value][2];normali=y2*z1-y1*z2;normalj=x1*z2-x2*z1;normalk=x2*y1-x1*y2;magNormal=z/Math.sqrt(normali*normali+normalj*normalj+normalk*normalk);var movex=-normali*magNormal|0;var movey=-normalj*magNormal|0;var movez=-normalk*magNormal|0;POLYMESH[value][0]+=movex;POLYMESH[value][1]+=movey;POLYMESH[value][2]+=movez;POLYMESH[value][3]+=movex;POLYMESH[value][4]+=movey;POLYMESH[value][5]+=movez;POLYMESH[value][6]+=movex;POLYMESH[value][7]+=movey;POLYMESH[value][8]+=movez}};ThreeD.prototype.normalMap=function(normalMap){var x1,y1,z1,x2,y2,z2;var normali,normalj,normalk,magNormal;for(var value=POLYMESH.length;--value>=0;){x1=POLYMESH[value][3]-POLYMESH[value][0];y1=POLYMESH[value][4]-POLYMESH[value][1];z1=POLYMESH[value][5]-POLYMESH[value][2];x2=POLYMESH[value][6]-POLYMESH[value][0];y2=POLYMESH[value][7]-POLYMESH[value][1];z2=POLYMESH[value][8]-POLYMESH[value][2];normali=y2*z1-y1*z2;normalj=x1*z2-x2*z1;normalk=x2*y1-x1*y2;normal=1/Math.sqrt(normali*normali+normalj*normalj+normalk*normalk);for(index2=0;index2<4;index2++){for(index=0;index<=index2;index++){magNormal=normalMap[index][index2]*normal|0;var movex=-normali*magNormal;var movey=-normalj*magNormal;var movez=-normalk*magNormal;POLYMESH[POLYMESH.length]=new Array(POLYMESH[value][0]+movex,POLYMESH[value][1]+movey,POLYMESH[value][2]+movez,POLYMESH[value][3]+movex,POLYMESH[value][4]+movey,POLYMESH[value][7]+movez,POLYMESH[value][6]+movex,POLYMESH[value][7]+movey,POLYMESH[value][8]+movez,POLYMESH[value][9],POLYMESH[value][10],POLYMESH[value][11],POLYMESH[value][12],POLYMESH[value][13],true,index,index2)}}}};ThreeD.prototype.move=function(x,y,z){for(var value=POLYMESH.length;--value>=0;)for(var point=-1;++point<3;){POLYMESH[value][point*3+2]+=z;POLYMESH[value][point*3+1]+=y;POLYMESH[value][point*3]+=x}};ThreeD.prototype.rotate=function(anglex,angley,anglez){var cosx=Math.cos(anglex*.01745329);var sinx=Math.sin(anglex*.01745329);var cosy=Math.cos(angley*.01745329);var siny=Math.sin(angley*.01745329);var cosz=Math.cos(anglez*.01745329);var sinz=Math.sin(anglez*.01745329);for(var value=POLYMESH.length;--value>=0;)for(var point=-1;++point<3;){var tempz=sinx*POLYMESH[value][point*3+1]+cosx*POLYMESH[value][point*3+2];var tempy=cosx*POLYMESH[value][point*3+1]-sinx*POLYMESH[value][point*3+2];var tempx=cosy*POLYMESH[value][point*3]+siny*tempz;POLYMESH[value][point*3+2]=cosy*tempz-siny*POLYMESH[value][point*3];POLYMESH[value][point*3+1]=sinz*tempx+cosz*tempy;
POLYMESH[value][point*3]=cosz*tempx-sinz*tempy}};ThreeD.prototype.scale=function(scalex,scaley,scalez){for(var value=POLYMESH.length;--value>=0;)for(var point=-1;++point<3;){POLYMESH[value][point*3+2]*=scalex;POLYMESH[value][point*3+1]*=scaley;POLYMESH[value][point*3]*=scalez}};ThreeD.prototype.backface=function(){for(var value=POLYMESH.length,newvalue=0,TempPOLYMESH=[];--value>=0;)if((POLYMESH[value][3]-POLYMESH[value][0])*(POLYMESH[value][7]-POLYMESH[value][1])-(POLYMESH[value][6]-POLYMESH[value][0])*(POLYMESH[value][4]-POLYMESH[value][1])>0){TempPOLYMESH[newvalue++]=POLYMESH[value].slice()}POLYMESH=TempPOLYMESH};ThreeD.prototype.zSort=function(){POLYMESH.sort(function(b,a){return b[2]+b[5]+b[8]-a[2]-a[5]-a[8]})};ThreeD.prototype.fade=function(bright){for(var value=POLYMESH.length;--value>=0;)POLYMESH[value][13]+=bright};ThreeD.prototype.shade=function(){var x1,y1,z1,x2,y2,z2;var normali,normalj,normalk,magNormal;var lighti,lightj,lightk,magLight;for(var value=POLYMESH.length;--value>=0;){x1=POLYMESH[value][3]-POLYMESH[value][0];y1=POLYMESH[value][4]-POLYMESH[value][1];z1=POLYMESH[value][5]-POLYMESH[value][2];x2=POLYMESH[value][6]-POLYMESH[value][0];y2=POLYMESH[value][7]-POLYMESH[value][1];z2=POLYMESH[value][8]-POLYMESH[value][2];normali=y1*z2-y2*z1;normalj=x2*z1-x1*z2;normalk=x1*y2-x2*y1;lighti=LIGHTX-(POLYMESH[value][0]+POLYMESH[value][3]+POLYMESH[value][6])*.3333333333333333;lightj=LIGHTY-(POLYMESH[value][1]+POLYMESH[value][4]+POLYMESH[value][7])*.3333333333333333;lightk=LIGHTZ-(POLYMESH[value][2]+POLYMESH[value][5]+POLYMESH[value][8])*.3333333333333333;POLYMESH[value][13]=2*(normali*lighti+normalj*lightj+normalk*lightk)/Math.sqrt((normali*normali+normalj*normalj+normalk*normalk)*(lighti*lighti+lightj*lightj+lightk*lightk))-1}};ThreeD.prototype.reColor=function(r,g,b){r=r>255?255:r<0?0:r|0;g=g>255?255:g<0?0:g|0;b=b>255?255:b<0?0:b|0;for(var value=POLYMESH.length;--value>=0;){POLYMESH[value][9]=r;POLYMESH[value][10]=g;POLYMESH[value][11]=b}};ThreeD.prototype.shadow=function(){rayorigins=[];raynormals=[];edge1=[];edge2=[];for(var value=0,normali,normalj,normalk,magNormal;value<POLYMESH.length;value++){edge1[value]=new Array(POLYMESH[value][3]-POLYMESH[value][0],POLYMESH[value][4]-POLYMESH[value][1],POLYMESH[value][5]-POLYMESH[value][2]);edge2[value]=new Array(POLYMESH[value][6]-POLYMESH[value][0],POLYMESH[value][7]-POLYMESH[value][1],POLYMESH[value][8]-POLYMESH[value][2]);rayorigins[value]=new Array((POLYMESH[value][0]+POLYMESH[value][3]+POLYMESH[value][6])*.3333333333333333,(POLYMESH[value][1]+POLYMESH[value][4]+POLYMESH[value][7])*.3333333333333333,(POLYMESH[value][2]+POLYMESH[value][5]+POLYMESH[value][8])*.3333333333333333);normali=LIGHTX-rayorigins[value][0];normalj=LIGHTY-rayorigins[value][1];normalk=LIGHTZ-rayorigins[value][2];magNormal=1/Math.sqrt(normali*normali+normalj*normalj+normalk*normalk);raynormals[value]=new Array(normali*magNormal,normalj*magNormal,normalk*magNormal)}for(var value=POLYMESH.length;--value>=0;){for(var value2=POLYMESH.length;--value2>=0;){if(value2!=value){var pvecti=raynormals[value][1]*edge2[value2][2]-edge2[value2][1]*raynormals[value][2];var pvectj=edge2[value2][0]*raynormals[value][2]-raynormals[value][0]*edge2[value2][2];var pvectk=raynormals[value][0]*edge2[value2][1]-edge2[value2][0]*raynormals[value][1];if((det=edge1[value2][0]*pvecti+edge1[value2][1]*pvectj+edge1[value2][2]*pvectk)<0){det=1/det;var tvecti=rayorigins[value][0]-POLYMESH[value2][0];var tvectj=rayorigins[value][1]-POLYMESH[value2][1];var tvectk=rayorigins[value][2]-POLYMESH[value2][2];if((u=(pvecti*tvecti+pvectj*tvectj+pvectk*tvectk)*det)>=0&&u<=1){if((v=(raynormals[value][0]*(tvectj*edge1[value2][2]-edge1[value2][1]*tvectk)+raynormals[value][1]*(edge1[value2][0]*tvectk-tvecti*edge1[value2][2])+raynormals[value][2]*(tvecti*edge1[value2][1]-edge1[value2][0]*tvectj))*det)>=0&&u+v<=1){POLYMESH[value][13]-=.5;break}}}}}}};ThreeD.prototype.getTranslation=function(){for(var value=POLYMESH.length,newvalue=0,TransPOLYMESH=[];--value>=0;){var POLYMESH2=5e3/(5e3-POLYMESH[value][2]),POLYMESH5=5e3/(5e3-POLYMESH[value][5]),POLYMESH8=5e3/(5e3-POLYMESH[value][8]);TransPOLYMESH[newvalue++]=new Array(CENTERX+POLYMESH[value][0]*POLYMESH2,CENTERY+POLYMESH[value][1]*POLYMESH2,CENTERX+POLYMESH[value][3]*POLYMESH5,CENTERY+POLYMESH[value][4]*POLYMESH5,CENTERX+POLYMESH[value][6]*POLYMESH8,CENTERY+POLYMESH[value][7]*POLYMESH8,POLYMESH[value][9]|0,POLYMESH[value][10]|0,POLYMESH[value][11]|0,POLYMESH[value][12]|0,POLYMESH[value][13])}return TransPOLYMESH};ThreeDee=new ThreeD;function Drawing(){this.WIREFRAME=1;this.FILL=2;ZOOM=1;CANVAS=null;TEXTURES=null}Drawing.prototype.initialize=function(canvas){CANVAS=canvas.getContext("2d");CANVAS.lineJoin="round";CANVAS.lineWidth=1};Drawing.prototype.loadTextures=function(textures){TEXTURES=textures};Drawing.prototype.setFillColor=function(r,g,b){CANVAS.fillStyle="rgb("+(r>255?255:r<0?0:r|0)+", "+(g>255?255:g<0?0:g|0)+", "+(b>255?255:b<0?0:b|0)+")"};Drawing.prototype.setFillColorA=function(r,g,b,a){CANVAS.fillStyle="rgba("+(r>255?255:r<0?0:r|0)+", "+(g>255?255:g<0?0:g|0)+", "+(b>255?255:b<0?0:b|0)+", "+(a>255?1:a<0?0:a/255)+")"};Drawing.prototype.setLineColor=function(r,g,b){CANVAS.strokeStyle="rgb("+(r>255?255:r<0?0:r|0)+", "+(g>255?255:g<0?0:g|0)+", "+(b>255?255:b<0?0:b|0)+")"};Drawing.prototype.setLineColorA=function(r,g,b,a){CANVAS.strokeStyle="rgba("+(r>255?255:r<0?0:r|0)+", "+(g>255?255:g<0?0:g|0)+", "+(b>255?255:b<0?0:b|0)+", "+(a>255?1:a<0?0:a/255)+")"};Drawing.prototype.clipCircle=function(centerx,centery,radius){CANVAS.beginPath();CANVAS.arc(centerx,centery,radius,0,6.28318531,false);CANVAS.clip()};Drawing.prototype.clipRectangle=function(x1,y1,x2,y2){CANVAS.beginPath();CANVAS.strokeRect(x1,y1,x2-x1,y2-y1);CANVAS.clip()};Drawing.prototype.drawCircle=function(centerx,centery,radius,style){CANVAS.beginPath();CANVAS.arc(centerx,centery,radius,0,Math.PI*2,false);if(style&this.FILL)CANVAS.fill();if(style&this.WIREFRAME)CANVAS.stroke()};Drawing.prototype.drawImage=function(x1,y1,x2,y2,img,angle){if(img.complete){x1|=0;y1|=0;x2|=0;y2|=0;if(x2<x1)x2=x1+1;if(y2<y1)y2=y1+1;var centerx=x1+x2>>1;var centery=y1+y2>>1;CANVAS.save();CANVAS.translate(centerx,centery);if(angle)CANVAS.rotate(angle*.01745329);CANVAS.drawImage(img,x1-centerx,y1-centery,x2-x1,y2-y1);CANVAS.restore()}};Drawing.prototype.drawLine=function(x1,y1,x2,y2){CANVAS.beginPath();CANVAS.moveTo(x1|0,y1|0);CANVAS.lineTo(x2|0,y2|0);CANVAS.stroke()};Drawing.prototype.drawRectangle=function(x1,y1,x2,y2,style,angle){x1|=0;y1|=0;x2|=0;y2|=0;if(!angle){if(style&this.FILL)CANVAS.fillRect(x1,y1,x2-x1,y2-y1);if(style&this.WIREFRAME)CANVAS.strokeRect(x1,y1,x2-x1,y2-y1)}else{var centerx=x1+x2>>1;var centery=y1+y2>>1;CANVAS.save();CANVAS.translate(centerx,centery);CANVAS.rotate(angle*DEGTORAD);if(style&this.FILL)CANVAS.fillRect(x1-centerx,y1-centery,x2-x1,y2-y1);if(style&this.WIREFRAME)CANVAS.strokeRect(x1-centerx,y1-centery,x2-x1,y2-y1);CANVAS.restore()}};Drawing.prototype.drawScene=function(array,style){var piOver2=1.570796326794897;var piOver4=.785398163397448;var sqrt2half=1.414213562373095;for(tri=array.length;--tri>=0;){var x1=array[tri][0];var y1=array[tri][1];var x2=array[tri][2];var y2=array[tri][3];var x3=array[tri][4];var y3=array[tri][5];shade=array[tri][10];if(TEXTURES&&array[tri][9]>=0){CANVAS.save();var u=(x2-x3)*(x2-x3)+(y2-y3)*(y2-y3);var v=(x1-x3)*(x1-x3)+(y1-y3)*(y1-y3);var w=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);var canvasRot=.5*Math.acos((w+v-u)/(2*Math.sqrt(w*v)));var scale=Math.cos(canvasRot)*sqrt2half;CANVAS.translate(x1,y1);CANVAS.rotate(Math.atan2(y2-y1,x2-x1)-piOver2+canvasRot);CANVAS.scale(Math.tan(canvasRot),1);CANVAS.rotate(piOver4);CANVAS.scale(Math.sqrt(w)*scale,Math.sqrt(v)*scale);CANVAS.drawImage(canvasimg=TEXTURES[array[tri][9]],0,0,canvasimg.width,canvasimg.height,0,0,1,1);CANVAS.restore();if(shade!=0){CANVAS.beginPath();CANVAS.moveTo(x1,y1);CANVAS.lineTo(x2,y2);CANVAS.lineTo(x3,y3);CANVAS.lineTo(x1,y1);if(shade>0){if(shade>1)shade=1;CANVAS.fillStyle="rgba(255,255,255,"+shade+")";CANVAS.strokeStyle="rgba(255,255,255,"+shade*.5+")"}else if(shade<0){if(shade<-1)shade=-1;CANVAS.fillStyle="rgba(0,0,0,"+-shade+")";CANVAS.strokeStyle="rgba(0,0,0,"+-shade*.5+")"}if(style&this.FILL)CANVAS.fill();if(style&this.WIREFRAME)CANVAS.stroke()}}else{var red=array[tri][6];var green=array[tri][7];var blue=array[tri][8];if(shade!=0){red=(red*=++shade)>255?255:red<0?0:red;green=(green*=shade)>255?255:green<0?0:green;blue=(blue*=shade)>255?255:blue<0?0:blue}var color="rgb("+(red|0)+","+(green|0)+","+(blue|0)+")";CANVAS.beginPath();CANVAS.moveTo(x1,y1);CANVAS.lineTo(x2,y2);CANVAS.lineTo(x3,y3);CANVAS.lineTo(x1,y1);if(style&this.FILL){CANVAS.fillStyle=color;CANVAS.fill()}if(style&this.WIREFRAME){CANVAS.strokeStyle=color;CANVAS.stroke()}}}};Drawing.prototype.drawFloor=function(x1,x2,y1,x3,x4,y2,img){if((x2|=0)==(x1|=0))x2++;if((y2|=0)==(y1|=0))y2++;if((x4|=0)==(x3|=0))x4++;var absdy=(dy=y2-y1)<0?-dy:dy;var sourceD=img.width-1,sourceY=(img.height-1)*(dx2=x4-x3)/dy;var destX=(x3-x1)/dy;var tempY=0;var destW2=dx1=x2-x1;var absscale=(fullscale=1.5*(dy>>31?-1:1)+dy/img.height)>>31?-(fullscale-1):fullscale+1;var destwfullscale=fullscale*(dx2-dx1+1)/dy;while(tempY<0?-tempY:tempY<=absdy){CANVAS.drawImage(img,0,sourceY*tempY/destW2,sourceD,1,x1+destX*tempY,tempY+y1,destW2,absscale);tempY+=fullscale;destW2+=destwfullscale}};Drawing.prototype.drawWall=function(x1,y1,y2,x2,y3,y4,img){if(x2==x1)x2++;if(y2==y1)y2++;if(y4==y3)y4++;var dx=x2-x1,dy1=y2-y1,dy2=y4-y3;var absdx=dx<0?-dx:dx;var sourceH=img.height-1,sourceX=(img.width-1)*dy2/dx;var destY=(y3-y1)/dx;var tempX=0;var fullscale=1.5*(dx<0?-1:1)+dx/img.width;var absscale=fullscale<0?-fullscale-1:fullscale+1;var desthfullscale=fullscale*(dy2-dy1+1)/dx;while(tempX<0?-tempX:tempX<=absdx){CANVAS.drawImage(img,sourceX*tempX/dy1,0,1,sourceH,tempX+x1,y1+destY*tempX,absscale,dy1);tempX+=fullscale;dy1+=desthfullscale}};Drawing.prototype.zoom=function(zoom,width,height){ZOOM=zoom;CANVAS.translate(width>>1,height>>1);CANVAS.scale(ZOOM,ZOOM);CANVAS.translate(-width>>1,-height>>1)};Drawing.prototype.unZoom=function(width,height){CANVAS.translate(width>>1,height>>1);CANVAS.scale(1/ZOOM,1/ZOOM);CANVAS.translate(-width>>1,-height>>1);ZOOM=1};Drawing.prototype.clear=function(x1,y1,x2,y2){CANVAS.clearRect(x1,y1,x2-x1,y2-y1)};Draw=new Drawing;var jWorkflow=function(){function _valid(func){if(typeof func!=="function"){throw"expected function but was "+typeof func}}function _isWorkflow(func){return typeof func.andThen==="function"&&typeof func.start==="function"&&typeof func.chill==="function"}function _isArray(func){return!!func.map&&!!func.reduce}var transfunctioner={order:function(func,context){var _workflow=[],_tasks,_callback=null,_baton=function(){var _taken=false;return{take:function(){_taken=true},pass:function(result){var task;_taken=false;if(_tasks.length){task=_tasks.shift();result=task.func.apply(task.context,[result,_baton]);if(!_taken){_baton.pass(result)}}else{if(_callback.func){_callback.func.apply(_callback.context,[result])}}},drop:function(result){_taken=true;_tasks=[];setTimeout(function(){_baton.pass(result)},1)}}}(),_self={andThen:function(func,context){if(_isWorkflow(func)){var f=function(prev,baton){baton.take();func.start({callback:function(result){setTimeout(function(){baton.pass(result)},1)},context:context,initialValue:prev})};_workflow.push({func:f,context:context})}else if(_isArray(func)){var orch=function(prev,baton){baton.take();var l=func.length,join=function(){return--l||setTimeout(function(){baton.pass()},1)};func.forEach(function(f){jWorkflow.order(f).start(join)})};_workflow.push({func:orch,context:context})}else{_valid(func);_workflow.push({func:func,context:context})}return _self},chill:function(time){return _self.andThen(function(prev,baton){baton.take();setTimeout(function(){baton.pass(prev)},time)})},start:function(){var callback,context,initialValue;if(arguments[0]&&typeof arguments[0]==="object"){callback=arguments[0].callback;context=arguments[0].context;initialValue=arguments[0].initialValue}else{callback=arguments[0];context=arguments[1]}_callback={func:callback,context:context};_tasks=_workflow.slice();_baton.pass(initialValue)}};return func?_self.andThen(func,context):_self}};return transfunctioner}();if(typeof module==="object"&&typeof require==="function"){module.exports=jWorkflow}var OpenLayers={VERSION_NUMBER:"Release 2.12",singleFile:!0,_getScriptLocation:function(){for(var a=/(^|(.*?\/))(OpenLayers[^\/]*?\.js)(\?|$)/,b=document.getElementsByTagName("script"),c,d="",e=0,f=b.length;e<f;e++)if(c=b[e].getAttribute("src"))if(c=c.match(a)){d=c[1];break}return function(){return d}}(),ImgPath:""};OpenLayers.Class=function(){var a=arguments.length,b=arguments[0],c=arguments[a-1],d="function"==typeof c.initialize?c.initialize:function(){b.prototype.initialize.apply(this,arguments)};1<a?(a=[d,b].concat(Array.prototype.slice.call(arguments).slice(1,a-1),c),OpenLayers.inherit.apply(null,a)):d.prototype=c;return d};OpenLayers.inherit=function(a,b){var c=function(){};c.prototype=b.prototype;a.prototype=new c;var d,e,c=2;for(d=arguments.length;c<d;c++)e=arguments[c],"function"===typeof e&&(e=e.prototype),OpenLayers.Util.extend(a.prototype,e)};OpenLayers.Util=OpenLayers.Util||{};OpenLayers.Util.extend=function(a,b){a=a||{};if(b){for(var c in b){var d=b[c];void 0!==d&&(a[c]=d)}!("function"==typeof window.Event&&b instanceof window.Event)&&(b.hasOwnProperty&&b.hasOwnProperty("toString"))&&(a.toString=b.toString)}return a};OpenLayers.String={startsWith:function(a,b){return 0==a.indexOf(b)},contains:function(a,b){return-1!=a.indexOf(b)},trim:function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},camelize:function(a){for(var a=a.split("-"),b=a[0],c=1,d=a.length;c<d;c++)var e=a[c],b=b+(e.charAt(0).toUpperCase()+e.substring(1));return b},format:function(a,b,c){b||(b=window);return a.replace(OpenLayers.String.tokenRegEx,function(a,e){for(var f,g=e.split(/\.+/),h=0;h<g.length;h++)0==h&&(f=b),f=f[g[h]];"function"==typeof f&&(f=c?f.apply(null,c):f());return"undefined"==typeof f?"undefined":f})},tokenRegEx:/\$\{([\w.]+?)\}/g,numberRegEx:/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,isNumeric:function(a){return OpenLayers.String.numberRegEx.test(a)},numericIf:function(a){return OpenLayers.String.isNumeric(a)?parseFloat(a):a}};OpenLayers.Number={decimalSeparator:".",thousandsSeparator:",",limitSigDigs:function(a,b){var c=0;0<b&&(c=parseFloat(a.toPrecision(b)));return c},format:function(a,b,c,d){b="undefined"!=typeof b?b:0;c="undefined"!=typeof c?c:OpenLayers.Number.thousandsSeparator;d="undefined"!=typeof d?d:OpenLayers.Number.decimalSeparator;null!=b&&(a=parseFloat(a.toFixed(b)));var e=a.toString().split(".");1==e.length&&null==b&&(b=0);a=e[0];if(c)for(var f=/(-?[0-9]+)([0-9]{3})/;f.test(a);)a=a.replace(f,"$1"+c+"$2");0==b?b=a:(c=1<e.length?e[1]:"0",null!=b&&(c+=Array(b-c.length+1).join("0")),b=a+d+c);return b}};OpenLayers.Function={bind:function(a,b){var c=Array.prototype.slice.apply(arguments,[2]);return function(){var d=c.concat(Array.prototype.slice.apply(arguments,[0]));return a.apply(b,d)}},bindAsEventListener:function(a,b){return function(c){return a.call(b,c||window.event)}},False:function(){return!1},True:function(){return!0},Void:function(){}};OpenLayers.Array={filter:function(a,b,c){var d=[];if(Array.prototype.filter)d=a.filter(b,c);else{var e=a.length;if("function"!=typeof b)throw new TypeError;for(var f=0;f<e;f++)if(f in a){var g=a[f];b.call(c,g,f,a)&&d.push(g)}}return d}};OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,centerLonLat:null,initialize:function(a,b,c,d){OpenLayers.Util.isArray(a)&&(d=a[3],c=a[2],b=a[1],a=a[0]);null!=a&&(this.left=OpenLayers.Util.toFloat(a));null!=b&&(this.bottom=OpenLayers.Util.toFloat(b));null!=c&&(this.right=OpenLayers.Util.toFloat(c));null!=d&&(this.top=OpenLayers.Util.toFloat(d))},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top)},equals:function(a){var b=!1;null!=a&&(b=this.left==a.left&&this.right==a.right&&this.top==a.top&&this.bottom==a.bottom);return b},toString:function(){return[this.left,this.bottom,this.right,this.top].join()},toArray:function(a){return!0===a?[this.bottom,this.left,this.top,this.right]:[this.left,this.bottom,this.right,this.top]},toBBOX:function(a,b){null==a&&(a=6);var c=Math.pow(10,a),d=Math.round(this.left*c)/c,e=Math.round(this.bottom*c)/c,f=Math.round(this.right*c)/c,c=Math.round(this.top*c)/c;return!0===b?e+","+d+","+c+","+f:d+","+e+","+f+","+c},toGeometry:function(){return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(this.left,this.bottom),new OpenLayers.Geometry.Point(this.right,this.bottom),new OpenLayers.Geometry.Point(this.right,this.top),new OpenLayers.Geometry.Point(this.left,this.top)])])},getWidth:function(){return this.right-this.left},getHeight:function(){return this.top-this.bottom},getSize:function(){return new OpenLayers.Size(this.getWidth(),this.getHeight())},getCenterPixel:function(){return new OpenLayers.Pixel((this.left+this.right)/2,(this.bottom+this.top)/2)},getCenterLonLat:function(){this.centerLonLat||(this.centerLonLat=new OpenLayers.LonLat((this.left+this.right)/2,(this.bottom+this.top)/2));return this.centerLonLat},scale:function(a,b){null==b&&(b=this.getCenterLonLat());var c,d;"OpenLayers.LonLat"==b.CLASS_NAME?(c=b.lon,d=b.lat):(c=b.x,d=b.y);return new OpenLayers.Bounds((this.left-c)*a+c,(this.bottom-d)*a+d,(this.right-c)*a+c,(this.top-d)*a+d)},add:function(a,b){if(null==a||null==b)throw new TypeError("Bounds.add cannot receive null values");return new OpenLayers.Bounds(this.left+a,this.bottom+b,this.right+a,this.top+b)},extend:function(a){var b=null;if(a){switch(a.CLASS_NAME){case"OpenLayers.LonLat":b=new OpenLayers.Bounds(a.lon,a.lat,a.lon,a.lat);break;case"OpenLayers.Geometry.Point":b=new OpenLayers.Bounds(a.x,a.y,a.x,a.y);break;case"OpenLayers.Bounds":b=a}if(b){this.centerLonLat=null;if(null==this.left||b.left<this.left)this.left=b.left;if(null==this.bottom||b.bottom<this.bottom)this.bottom=b.bottom;if(null==this.right||b.right>this.right)this.right=b.right;if(null==this.top||b.top>this.top)this.top=b.top}}},containsLonLat:function(a,b){"boolean"===typeof b&&(b={inclusive:b});var b=b||{},c=this.contains(a.lon,a.lat,b.inclusive),d=b.worldBounds;d&&!c&&(c=d.getWidth(),d=Math.round((a.lon-(d.left+d.right)/2)/c),c=this.containsLonLat({lon:a.lon-d*c,lat:a.lat},{inclusive:b.inclusive}));return c},containsPixel:function(a,b){return this.contains(a.x,a.y,b)},contains:function(a,b,c){null==c&&(c=!0);if(null==a||null==b)return!1;var a=OpenLayers.Util.toFloat(a),b=OpenLayers.Util.toFloat(b),d=!1;return d=c?a>=this.left&&a<=this.right&&b>=this.bottom&&b<=this.top:a>this.left&&a<this.right&&b>this.bottom&&b<this.top},intersectsBounds:function(a,b){"boolean"===typeof b&&(b={inclusive:b});b=b||{};if(b.worldBounds)var c=this.wrapDateLine(b.worldBounds),a=a.wrapDateLine(b.worldBounds);else c=this;null==b.inclusive&&(b.inclusive=!0);var d=!1,e=c.left==a.right||c.right==a.left||c.top==a.bottom||c.bottom==a.top;if(b.inclusive||!e)var d=a.top>=c.bottom&&a.top<=c.top||c.top>a.bottom&&c.top<a.top,e=a.left>=c.left&&a.left<=c.right||c.left>=a.left&&c.left<=a.right,f=a.right>=c.left&&a.right<=c.right||c.right>=a.left&&c.right<=a.right,d=(a.bottom>=c.bottom&&a.bottom<=c.top||c.bottom>=a.bottom&&c.bottom<=a.top||d)&&(e||f);if(b.worldBounds&&!d){var g=b.worldBounds,e=g.getWidth(),f=!g.containsBounds(c),g=!g.containsBounds(a);f&&!g?(a=a.add(-e,0),d=c.intersectsBounds(a,{inclusive:b.inclusive})):g&&!f&&(c=c.add(-e,0),d=a.intersectsBounds(c,{inclusive:b.inclusive}))}return d},containsBounds:function(a,b,c){null==b&&(b=!1);null==c&&(c=!0);var d=this.contains(a.left,a.bottom,c),e=this.contains(a.right,a.bottom,c),f=this.contains(a.left,a.top,c),a=this.contains(a.right,a.top,c);return b?d||e||f||a:d&&e&&f&&a},determineQuadrant:function(a){var b="",c=this.getCenterLonLat(),b=b+(a.lat<c.lat?"b":"t");return b+=a.lon<c.lon?"l":"r"},transform:function(a,b){this.centerLonLat=null;var c=OpenLayers.Projection.transform({x:this.left,y:this.bottom},a,b),d=OpenLayers.Projection.transform({x:this.right,y:this.bottom},a,b),e=OpenLayers.Projection.transform({x:this.left,y:this.top},a,b),f=OpenLayers.Projection.transform({x:this.right,y:this.top},a,b);this.left=Math.min(c.x,e.x);this.bottom=Math.min(c.y,d.y);this.right=Math.max(d.x,f.x);this.top=Math.max(e.y,f.y);return this},wrapDateLine:function(a,b){var b=b||{},c=b.leftTolerance||0,d=b.rightTolerance||0,e=this.clone();if(a){for(var f=a.getWidth();e.left<a.left&&e.right-d<=a.left;)e=e.add(f,0);for(;e.left+c>=a.right&&e.right>a.right;)e=e.add(-f,0);c=e.left+c;c<a.right&&(c>a.left&&e.right-d>a.right)&&(e=e.add(-f,0))}return e},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(a,b){var c=a.split(",");return OpenLayers.Bounds.fromArray(c,b)};OpenLayers.Bounds.fromArray=function(a,b){return!0===b?new OpenLayers.Bounds(a[1],a[0],a[3],a[2]):new OpenLayers.Bounds(a[0],a[1],a[2],a[3])};OpenLayers.Bounds.fromSize=function(a){return new OpenLayers.Bounds(0,a.h,a.w,0)};OpenLayers.Bounds.oppositeQuadrant=function(a){var b;b=""+("t"==a.charAt(0)?"b":"t");return b+="l"==a.charAt(1)?"r":"l"};OpenLayers.Element={visible:function(a){return"none"!=OpenLayers.Util.getElement(a).style.display},toggle:function(){for(var a=0,b=arguments.length;a<b;a++){var c=OpenLayers.Util.getElement(arguments[a]),d=OpenLayers.Element.visible(c)?"none":"";c.style.display=d}},remove:function(a){a=OpenLayers.Util.getElement(a);a.parentNode.removeChild(a)},getHeight:function(a){a=OpenLayers.Util.getElement(a);return a.offsetHeight},hasClass:function(a,b){var c=a.className;return!!c&&RegExp("(^|\\s)"+b+"(\\s|$)").test(c)},addClass:function(a,b){OpenLayers.Element.hasClass(a,b)||(a.className+=(a.className?" ":"")+b);return a},removeClass:function(a,b){var c=a.className;c&&(a.className=OpenLayers.String.trim(c.replace(RegExp("(^|\\s+)"+b+"(\\s+|$)")," ")));return a},toggleClass:function(a,b){OpenLayers.Element.hasClass(a,b)?OpenLayers.Element.removeClass(a,b):OpenLayers.Element.addClass(a,b);return a},getStyle:function(a,b){var a=OpenLayers.Util.getElement(a),c=null;if(a&&a.style){c=a.style[OpenLayers.String.camelize(b)];c||(document.defaultView&&document.defaultView.getComputedStyle?c=(c=document.defaultView.getComputedStyle(a,null))?c.getPropertyValue(b):null:a.currentStyle&&(c=a.currentStyle[OpenLayers.String.camelize(b)]));var d=["left","top","right","bottom"];window.opera&&(-1!=OpenLayers.Util.indexOf(d,b)&&"static"==OpenLayers.Element.getStyle(a,"position"))&&(c="auto")}return"auto"==c?null:c}};OpenLayers.LonLat=OpenLayers.Class({lon:0,lat:0,initialize:function(a,b){OpenLayers.Util.isArray(a)&&(b=a[1],a=a[0]);this.lon=OpenLayers.Util.toFloat(a);this.lat=OpenLayers.Util.toFloat(b)},toString:function(){return"lon="+this.lon+",lat="+this.lat},toShortString:function(){return this.lon+", "+this.lat},clone:function(){return new OpenLayers.LonLat(this.lon,this.lat)},add:function(a,b){if(null==a||null==b)throw new TypeError("LonLat.add cannot receive null values");return new OpenLayers.LonLat(this.lon+OpenLayers.Util.toFloat(a),this.lat+OpenLayers.Util.toFloat(b))},equals:function(a){var b=!1;null!=a&&(b=this.lon==a.lon&&this.lat==a.lat||isNaN(this.lon)&&isNaN(this.lat)&&isNaN(a.lon)&&isNaN(a.lat));return b},transform:function(a,b){var c=OpenLayers.Projection.transform({x:this.lon,y:this.lat},a,b);this.lon=c.x;this.lat=c.y;return this},wrapDateLine:function(a){var b=this.clone();if(a){for(;b.lon<a.left;)b.lon+=a.getWidth();for(;b.lon>a.right;)b.lon-=a.getWidth()}return b},CLASS_NAME:"OpenLayers.LonLat"});OpenLayers.LonLat.fromString=function(a){a=a.split(",");return new OpenLayers.LonLat(a[0],a[1])};OpenLayers.LonLat.fromArray=function(a){var b=OpenLayers.Util.isArray(a);return new OpenLayers.LonLat(b&&a[0],b&&a[1])};OpenLayers.Pixel=OpenLayers.Class({x:0,y:0,initialize:function(a,b){this.x=parseFloat(a);this.y=parseFloat(b)},toString:function(){return"x="+this.x+",y="+this.y},clone:function(){return new OpenLayers.Pixel(this.x,this.y)},equals:function(a){var b=!1;null!=a&&(b=this.x==a.x&&this.y==a.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y));return b},distanceTo:function(a){return Math.sqrt(Math.pow(this.x-a.x,2)+Math.pow(this.y-a.y,2))},add:function(a,b){if(null==a||null==b)throw new TypeError("Pixel.add cannot receive null values");return new OpenLayers.Pixel(this.x+a,this.y+b)},offset:function(a){var b=this.clone();a&&(b=this.add(a.x,a.y));return b},CLASS_NAME:"OpenLayers.Pixel"});OpenLayers.Size=OpenLayers.Class({w:0,h:0,initialize:function(a,b){this.w=parseFloat(a);this.h=parseFloat(b)},toString:function(){return"w="+this.w+",h="+this.h},clone:function(){return new OpenLayers.Size(this.w,this.h)},equals:function(a){var b=!1;null!=a&&(b=this.w==a.w&&this.h==a.h||isNaN(this.w)&&isNaN(this.h)&&isNaN(a.w)&&isNaN(a.h));return b},CLASS_NAME:"OpenLayers.Size"});OpenLayers.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},userError:function(a){alert(a)},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){},CLASS_NAME:"OpenLayers.Console"};(function(){for(var a=document.getElementsByTagName("script"),b=0,c=a.length;b<c;++b)if(-1!=a[b].src.indexOf("firebug.js")&&console){OpenLayers.Util.extend(OpenLayers.Console,console);break}})();OpenLayers.Lang={code:null,defaultCode:"en",getCode:function(){OpenLayers.Lang.code||OpenLayers.Lang.setCode();return OpenLayers.Lang.code},setCode:function(a){var b;a||(a="msie"==OpenLayers.BROWSER_NAME?navigator.userLanguage:navigator.language);a=a.split("-");a[0]=a[0].toLowerCase();"object"==typeof OpenLayers.Lang[a[0]]&&(b=a[0]);if(a[1]){var c=a[0]+"-"+a[1].toUpperCase();"object"==typeof OpenLayers.Lang[c]&&(b=c)}b||(OpenLayers.Console.warn("Failed to find OpenLayers.Lang."+a.join("-")+" dictionary, falling back to default language"),b=OpenLayers.Lang.defaultCode);OpenLayers.Lang.code=b},translate:function(a,b){var c=OpenLayers.Lang[OpenLayers.Lang.getCode()];(c=c&&c[a])||(c=a);b&&(c=OpenLayers.String.format(c,b));return c}};OpenLayers.i18n=OpenLayers.Lang.translate;OpenLayers.Util=OpenLayers.Util||{};OpenLayers.Util.getElement=function(){for(var a=[],b=0,c=arguments.length;b<c;b++){var d=arguments[b];"string"==typeof d&&(d=document.getElementById(d));if(1==arguments.length)return d;a.push(d)}return a};OpenLayers.Util.isElement=function(a){return!!(a&&1===a.nodeType)};OpenLayers.Util.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)};"undefined"===typeof window.$&&(window.$=OpenLayers.Util.getElement);OpenLayers.Util.removeItem=function(a,b){for(var c=a.length-1;c>=0;c--)a[c]==b&&a.splice(c,1);return a};OpenLayers.Util.indexOf=function(a,b){if(typeof a.indexOf=="function")return a.indexOf(b);for(var c=0,d=a.length;c<d;c++)if(a[c]==b)return c;return-1};OpenLayers.Util.modifyDOMElement=function(a,b,c,d,e,f,g,h){if(b)a.id=b;if(c){a.style.left=c.x+"px";a.style.top=c.y+"px"}if(d){a.style.width=d.w+"px";a.style.height=d.h+"px"}if(e)a.style.position=e;if(f)a.style.border=f;if(g)a.style.overflow=g;if(parseFloat(h)>=0&&parseFloat(h)<1){a.style.filter="alpha(opacity="+h*100+")";a.style.opacity=h}else if(parseFloat(h)==1){a.style.filter="";a.style.opacity=""}};OpenLayers.Util.createDiv=function(a,b,c,d,e,f,g,h){var i=document.createElement("div");if(d)i.style.backgroundImage="url("+d+")";a||(a=OpenLayers.Util.createUniqueID("OpenLayersDiv"));e||(e="absolute");OpenLayers.Util.modifyDOMElement(i,a,b,c,e,f,g,h);return i};OpenLayers.Util.createImage=function(a,b,c,d,e,f,g,h){var i=document.createElement("img");a||(a=OpenLayers.Util.createUniqueID("OpenLayersDiv"));e||(e="relative");OpenLayers.Util.modifyDOMElement(i,a,b,c,e,f,null,g);if(h){i.style.display="none";b=function(){i.style.display="";OpenLayers.Event.stopObservingElement(i)};OpenLayers.Event.observe(i,"load",b);OpenLayers.Event.observe(i,"error",b)}i.style.alt=a;i.galleryImg="no";if(d)i.src=d;return i};OpenLayers.IMAGE_RELOAD_ATTEMPTS=0;OpenLayers.Util.alphaHackNeeded=null;OpenLayers.Util.alphaHack=function(){if(OpenLayers.Util.alphaHackNeeded==null){var a=navigator.appVersion.split("MSIE"),a=parseFloat(a[1]),b=false;try{b=!!document.body.filters}catch(c){}OpenLayers.Util.alphaHackNeeded=b&&a>=5.5&&a<7}return OpenLayers.Util.alphaHackNeeded};OpenLayers.Util.modifyAlphaImageDiv=function(a,b,c,d,e,f,g,h,i){OpenLayers.Util.modifyDOMElement(a,b,c,d,f,null,null,i);b=a.childNodes[0];if(e)b.src=e;OpenLayers.Util.modifyDOMElement(b,a.id+"_innerImage",null,d,"relative",g);if(OpenLayers.Util.alphaHack()){if(a.style.display!="none")a.style.display="inline-block";h==null&&(h="scale");a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b.src+"', sizingMethod='"+h+"')";if(parseFloat(a.style.opacity)>=0&&parseFloat(a.style.opacity)<1)a.style.filter=a.style.filter+(" alpha(opacity="+a.style.opacity*100+")");b.style.filter="alpha(opacity=0)"}};OpenLayers.Util.createAlphaImageDiv=function(a,b,c,d,e,f,g,h,i){var j=OpenLayers.Util.createDiv(),i=OpenLayers.Util.createImage(null,null,null,null,null,null,null,i);i.className="olAlphaImg";j.appendChild(i);OpenLayers.Util.modifyAlphaImageDiv(j,a,b,c,d,e,f,g,h);return j};OpenLayers.Util.upperCaseObject=function(a){var b={},c;for(c in a)b[c.toUpperCase()]=a[c];return b};OpenLayers.Util.applyDefaults=function(a,b){var a=a||{},c=typeof window.Event=="function"&&b instanceof window.Event,d;for(d in b)if(a[d]===void 0||!c&&b.hasOwnProperty&&b.hasOwnProperty(d)&&!a.hasOwnProperty(d))a[d]=b[d];if(!c&&b&&b.hasOwnProperty&&b.hasOwnProperty("toString")&&!a.hasOwnProperty("toString"))a.toString=b.toString;return a};OpenLayers.Util.getParameterString=function(a){var b=[],c;for(c in a){var d=a[c];if(d!=null&&typeof d!="function"){if(typeof d=="object"&&d.constructor==Array){for(var e=[],f,g=0,h=d.length;g<h;g++){f=d[g];e.push(encodeURIComponent(f===null||f===void 0?"":f))}d=e.join(",")}else d=encodeURIComponent(d);b.push(encodeURIComponent(c)+"="+d)}}return b.join("&")};OpenLayers.Util.urlAppend=function(a,b){var c=a;if(b)var d=(a+" ").split(/[?&]/),c=c+(d.pop()===" "?b:d.length?"&"+b:"?"+b);return c};OpenLayers.Util.getImagesLocation=function(){return OpenLayers.ImgPath||OpenLayers._getScriptLocation()+"img/"};OpenLayers.Util.getImageLocation=function(a){return OpenLayers.Util.getImagesLocation()+a};OpenLayers.Util.Try=function(){for(var a=null,b=0,c=arguments.length;b<c;b++){var d=arguments[b];try{a=d();break}catch(e){}}return a};OpenLayers.Util.getXmlNodeValue=function(a){var b=null;OpenLayers.Util.Try(function(){b=a.text;if(!b)b=a.textContent;if(!b)b=a.firstChild.nodeValue},function(){b=a.textContent});return b};OpenLayers.Util.mouseLeft=function(a,b){for(var c=a.relatedTarget?a.relatedTarget:a.toElement;c!=b&&c!=null;)c=c.parentNode;return c!=b};OpenLayers.Util.DEFAULT_PRECISION=14;OpenLayers.Util.toFloat=function(a,b){if(b==null)b=OpenLayers.Util.DEFAULT_PRECISION;typeof a!=="number"&&(a=parseFloat(a));return b===0?a:parseFloat(a.toPrecision(b))};OpenLayers.Util.rad=function(a){return a*Math.PI/180};OpenLayers.Util.deg=function(a){return a*180/Math.PI};OpenLayers.Util.VincentyConstants={a:6378137,b:6356752.3142,f:1/298.257223563};OpenLayers.Util.distVincenty=function(a,b){for(var c=OpenLayers.Util.VincentyConstants,d=c.a,e=c.b,c=c.f,f=OpenLayers.Util.rad(b.lon-a.lon),g=Math.atan((1-c)*Math.tan(OpenLayers.Util.rad(a.lat))),h=Math.atan((1-c)*Math.tan(OpenLayers.Util.rad(b.lat))),i=Math.sin(g),g=Math.cos(g),j=Math.sin(h),h=Math.cos(h),k=f,l=2*Math.PI,m=20;Math.abs(k-l)>1e-12&&--m>0;){var n=Math.sin(k),o=Math.cos(k),p=Math.sqrt(h*n*h*n+(g*j-i*h*o)*(g*j-i*h*o));if(p==0)return 0;var o=i*j+g*h*o,q=Math.atan2(p,o),r=Math.asin(g*h*n/p),s=Math.cos(r)*Math.cos(r),n=o-2*i*j/s,t=c/16*s*(4+c*(4-3*s)),l=k,k=f+(1-t)*c*Math.sin(r)*(q+t*p*(n+t*o*(-1+2*n*n)));
}if(m==0)return NaN;d=s*(d*d-e*e)/(e*e);c=d/1024*(256+d*(-128+d*(74-47*d)));return(e*(1+d/16384*(4096+d*(-768+d*(320-175*d))))*(q-c*p*(n+c/4*(o*(-1+2*n*n)-c/6*n*(-3+4*p*p)*(-3+4*n*n))))).toFixed(3)/1e3};OpenLayers.Util.destinationVincenty=function(a,b,c){for(var d=OpenLayers.Util,e=d.VincentyConstants,f=e.a,g=e.b,h=e.f,e=a.lon,a=a.lat,i=d.rad(b),b=Math.sin(i),i=Math.cos(i),a=(1-h)*Math.tan(d.rad(a)),j=1/Math.sqrt(1+a*a),k=a*j,l=Math.atan2(a,i),a=j*b,m=1-a*a,f=m*(f*f-g*g)/(g*g),n=1+f/16384*(4096+f*(-768+f*(320-175*f))),o=f/1024*(256+f*(-128+f*(74-47*f))),f=c/(g*n),p=2*Math.PI;Math.abs(f-p)>1e-12;)var q=Math.cos(2*l+f),r=Math.sin(f),s=Math.cos(f),t=o*r*(q+o/4*(s*(-1+2*q*q)-o/6*q*(-3+4*r*r)*(-3+4*q*q))),p=f,f=c/(g*n)+t;c=k*r-j*s*i;g=Math.atan2(k*s+j*r*i,(1-h)*Math.sqrt(a*a+c*c));b=Math.atan2(r*b,j*s-k*r*i);i=h/16*m*(4+h*(4-3*m));q=b-(1-i)*h*a*(f+i*r*(q+i*s*(-1+2*q*q)));Math.atan2(a,-c);return new OpenLayers.LonLat(e+d.deg(q),d.deg(g))};OpenLayers.Util.getParameters=function(a){var a=a===null||a===void 0?window.location.href:a,b="";if(OpenLayers.String.contains(a,"?"))var b=a.indexOf("?")+1,c=OpenLayers.String.contains(a,"#")?a.indexOf("#"):a.length,b=a.substring(b,c);for(var a={},b=b.split(/[&;]/),c=0,d=b.length;c<d;++c){var e=b[c].split("=");if(e[0]){var f=e[0];try{f=decodeURIComponent(f)}catch(g){f=unescape(f)}e=(e[1]||"").replace(/\+/g," ");try{e=decodeURIComponent(e)}catch(h){e=unescape(e)}e=e.split(",");e.length==1&&(e=e[0]);a[f]=e}}return a};OpenLayers.Util.lastSeqID=0;OpenLayers.Util.createUniqueID=function(a){a==null&&(a="id_");OpenLayers.Util.lastSeqID=OpenLayers.Util.lastSeqID+1;return a+OpenLayers.Util.lastSeqID};OpenLayers.INCHES_PER_UNIT={inches:1,ft:12,mi:63360,m:39.3701,km:39370.1,dd:4374754,yd:36};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;OpenLayers.INCHES_PER_UNIT.degrees=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.INCHES_PER_UNIT.nmi=1852*OpenLayers.INCHES_PER_UNIT.m;OpenLayers.METERS_PER_INCH=.0254000508001016;OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{Inch:OpenLayers.INCHES_PER_UNIT.inches,Meter:1/OpenLayers.METERS_PER_INCH,Foot:.3048006096012192/OpenLayers.METERS_PER_INCH,IFoot:.3048/OpenLayers.METERS_PER_INCH,ClarkeFoot:.3047972651151/OpenLayers.METERS_PER_INCH,SearsFoot:.30479947153867626/OpenLayers.METERS_PER_INCH,GoldCoastFoot:.3047997101815088/OpenLayers.METERS_PER_INCH,IInch:.0254/OpenLayers.METERS_PER_INCH,MicroInch:254e-7/OpenLayers.METERS_PER_INCH,Mil:2.54e-8/OpenLayers.METERS_PER_INCH,Centimeter:.01/OpenLayers.METERS_PER_INCH,Kilometer:1e3/OpenLayers.METERS_PER_INCH,Yard:.9144018288036576/OpenLayers.METERS_PER_INCH,SearsYard:.914398414616029/OpenLayers.METERS_PER_INCH,IndianYard:.9143985307444408/OpenLayers.METERS_PER_INCH,IndianYd37:.91439523/OpenLayers.METERS_PER_INCH,IndianYd62:.9143988/OpenLayers.METERS_PER_INCH,IndianYd75:.9143985/OpenLayers.METERS_PER_INCH,IndianFoot:.30479951/OpenLayers.METERS_PER_INCH,IndianFt37:.30479841/OpenLayers.METERS_PER_INCH,IndianFt62:.3047996/OpenLayers.METERS_PER_INCH,IndianFt75:.3047995/OpenLayers.METERS_PER_INCH,Mile:1609.3472186944373/OpenLayers.METERS_PER_INCH,IYard:.9144/OpenLayers.METERS_PER_INCH,IMile:1609.344/OpenLayers.METERS_PER_INCH,NautM:1852/OpenLayers.METERS_PER_INCH,"Lat-66":110943.31648893273/OpenLayers.METERS_PER_INCH,"Lat-83":110946.25736872235/OpenLayers.METERS_PER_INCH,Decimeter:.1/OpenLayers.METERS_PER_INCH,Millimeter:.001/OpenLayers.METERS_PER_INCH,Dekameter:10/OpenLayers.METERS_PER_INCH,Decameter:10/OpenLayers.METERS_PER_INCH,Hectometer:100/OpenLayers.METERS_PER_INCH,GermanMeter:1.0000135965/OpenLayers.METERS_PER_INCH,CaGrid:.999738/OpenLayers.METERS_PER_INCH,ClarkeChain:20.1166194976/OpenLayers.METERS_PER_INCH,GunterChain:20.11684023368047/OpenLayers.METERS_PER_INCH,BenoitChain:20.116782494375872/OpenLayers.METERS_PER_INCH,SearsChain:20.11676512155/OpenLayers.METERS_PER_INCH,ClarkeLink:.201166194976/OpenLayers.METERS_PER_INCH,GunterLink:.2011684023368047/OpenLayers.METERS_PER_INCH,BenoitLink:.20116782494375873/OpenLayers.METERS_PER_INCH,SearsLink:.2011676512155/OpenLayers.METERS_PER_INCH,Rod:5.02921005842012/OpenLayers.METERS_PER_INCH,IntnlChain:20.1168/OpenLayers.METERS_PER_INCH,IntnlLink:.201168/OpenLayers.METERS_PER_INCH,Perch:5.02921005842012/OpenLayers.METERS_PER_INCH,Pole:5.02921005842012/OpenLayers.METERS_PER_INCH,Furlong:201.1684023368046/OpenLayers.METERS_PER_INCH,Rood:3.778266898/OpenLayers.METERS_PER_INCH,CapeFoot:.3047972615/OpenLayers.METERS_PER_INCH,Brealey:375/OpenLayers.METERS_PER_INCH,ModAmFt:.304812252984506/OpenLayers.METERS_PER_INCH,Fathom:1.8288/OpenLayers.METERS_PER_INCH,"NautM-UK":1853.184/OpenLayers.METERS_PER_INCH,"50kilometers":5e4/OpenLayers.METERS_PER_INCH,"150kilometers":15e4/OpenLayers.METERS_PER_INCH});OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{mm:OpenLayers.INCHES_PER_UNIT.Meter/1e3,cm:OpenLayers.INCHES_PER_UNIT.Meter/100,dm:100*OpenLayers.INCHES_PER_UNIT.Meter,km:1e3*OpenLayers.INCHES_PER_UNIT.Meter,kmi:OpenLayers.INCHES_PER_UNIT.nmi,fath:OpenLayers.INCHES_PER_UNIT.Fathom,ch:OpenLayers.INCHES_PER_UNIT.IntnlChain,link:OpenLayers.INCHES_PER_UNIT.IntnlLink,"us-in":OpenLayers.INCHES_PER_UNIT.inches,"us-ft":OpenLayers.INCHES_PER_UNIT.Foot,"us-yd":OpenLayers.INCHES_PER_UNIT.Yard,"us-ch":OpenLayers.INCHES_PER_UNIT.GunterChain,"us-mi":OpenLayers.INCHES_PER_UNIT.Mile,"ind-yd":OpenLayers.INCHES_PER_UNIT.IndianYd37,"ind-ft":OpenLayers.INCHES_PER_UNIT.IndianFt37,"ind-ch":20.11669506/OpenLayers.METERS_PER_INCH});OpenLayers.DOTS_PER_INCH=72;OpenLayers.Util.normalizeScale=function(a){return a>1?1/a:a};OpenLayers.Util.getResolutionFromScale=function(a,b){var c;if(a){b==null&&(b="degrees");c=1/(OpenLayers.Util.normalizeScale(a)*OpenLayers.INCHES_PER_UNIT[b]*OpenLayers.DOTS_PER_INCH)}return c};OpenLayers.Util.getScaleFromResolution=function(a,b){b==null&&(b="degrees");return a*OpenLayers.INCHES_PER_UNIT[b]*OpenLayers.DOTS_PER_INCH};OpenLayers.Util.pagePosition=function(a){var b=[0,0],c=OpenLayers.Util.getViewportElement();if(!a||a==window||a==c)return b;var d=OpenLayers.IS_GECKO&&document.getBoxObjectFor&&OpenLayers.Element.getStyle(a,"position")=="absolute"&&(a.style.top==""||a.style.left==""),e=null;if(a.getBoundingClientRect){a=a.getBoundingClientRect();e=c.scrollTop;b[0]=a.left+c.scrollLeft;b[1]=a.top+e}else if(document.getBoxObjectFor&&!d){a=document.getBoxObjectFor(a);c=document.getBoxObjectFor(c);b[0]=a.screenX-c.screenX;b[1]=a.screenY-c.screenY}else{b[0]=a.offsetLeft;b[1]=a.offsetTop;e=a.offsetParent;if(e!=a)for(;e;){b[0]=b[0]+e.offsetLeft;b[1]=b[1]+e.offsetTop;e=e.offsetParent}c=OpenLayers.BROWSER_NAME;if(c=="opera"||c=="safari"&&OpenLayers.Element.getStyle(a,"position")=="absolute")b[1]=b[1]-document.body.offsetTop;for(e=a.offsetParent;e&&e!=document.body;){b[0]=b[0]-e.scrollLeft;if(c!="opera"||e.tagName!="TR")b[1]=b[1]-e.scrollTop;e=e.offsetParent}}return b};OpenLayers.Util.getViewportElement=function(){var a=arguments.callee.viewportElement;if(a==void 0){a=OpenLayers.BROWSER_NAME=="msie"&&document.compatMode!="CSS1Compat"?document.body:document.documentElement;arguments.callee.viewportElement=a}return a};OpenLayers.Util.isEquivalentUrl=function(a,b,c){c=c||{};OpenLayers.Util.applyDefaults(c,{ignoreCase:true,ignorePort80:true,ignoreHash:true});var a=OpenLayers.Util.createUrlObject(a,c),b=OpenLayers.Util.createUrlObject(b,c),d;for(d in a)if(d!=="args"&&a[d]!=b[d])return false;for(d in a.args){if(a.args[d]!=b.args[d])return false;delete b.args[d]}for(d in b.args)return false;return true};OpenLayers.Util.createUrlObject=function(a,b){b=b||{};if(!/^\w+:\/\//.test(a)){var c=window.location,d=c.port?":"+c.port:"",d=c.protocol+"//"+c.host.split(":").shift()+d;if(a.indexOf("/")===0)a=d+a;else{c=c.pathname.split("/");c.pop();a=d+c.join("/")+"/"+a}}b.ignoreCase&&(a=a.toLowerCase());c=document.createElement("a");c.href=a;d={};d.host=c.host.split(":").shift();d.protocol=c.protocol;d.port=b.ignorePort80?c.port=="80"||c.port=="0"?"":c.port:c.port==""||c.port=="0"?"80":c.port;d.hash=b.ignoreHash||c.hash==="#"?"":c.hash;var e=c.search;if(!e){e=a.indexOf("?");e=e!=-1?a.substr(e):""}d.args=OpenLayers.Util.getParameters(e);d.pathname=c.pathname.charAt(0)=="/"?c.pathname:"/"+c.pathname;return d};OpenLayers.Util.removeTail=function(a){var b=null,b=a.indexOf("?"),c=a.indexOf("#");return b=b==-1?c!=-1?a.substr(0,c):a:c!=-1?a.substr(0,Math.min(b,c)):a.substr(0,b)};OpenLayers.IS_GECKO=function(){var a=navigator.userAgent.toLowerCase();return a.indexOf("webkit")==-1&&a.indexOf("gecko")!=-1}();OpenLayers.CANVAS_SUPPORTED=function(){var a=document.createElement("canvas");return!(!a.getContext||!a.getContext("2d"))}();OpenLayers.BROWSER_NAME=function(){var a="",b=navigator.userAgent.toLowerCase();b.indexOf("opera")!=-1?a="opera":b.indexOf("msie")!=-1?a="msie":b.indexOf("safari")!=-1?a="safari":b.indexOf("mozilla")!=-1&&(a=b.indexOf("firefox")!=-1?"firefox":"mozilla");return a}();OpenLayers.Util.getBrowserName=function(){return OpenLayers.BROWSER_NAME};OpenLayers.Util.getRenderedDimensions=function(a,b,c){var d,e,f=document.createElement("div");f.style.visibility="hidden";for(var g=c&&c.containerElement?c.containerElement:document.body,h=false,i=null,j=g;j&&j.tagName.toLowerCase()!="body";){var k=OpenLayers.Element.getStyle(j,"position");if(k=="absolute"){h=true;break}else if(k&&k!="static")break;j=j.parentNode}if(h&&(g.clientHeight===0||g.clientWidth===0)){i=document.createElement("div");i.style.visibility="hidden";i.style.position="absolute";i.style.overflow="visible";i.style.width=document.body.clientWidth+"px";i.style.height=document.body.clientHeight+"px";i.appendChild(f)}f.style.position="absolute";if(b)if(b.w){d=b.w;f.style.width=d+"px"}else if(b.h){e=b.h;f.style.height=e+"px"}if(c&&c.displayClass)f.className=c.displayClass;b=document.createElement("div");b.innerHTML=a;b.style.overflow="visible";if(b.childNodes){a=0;for(c=b.childNodes.length;a<c;a++)if(b.childNodes[a].style)b.childNodes[a].style.overflow="visible"}f.appendChild(b);i?g.appendChild(i):g.appendChild(f);if(!d){d=parseInt(b.scrollWidth);f.style.width=d+"px"}e||(e=parseInt(b.scrollHeight));f.removeChild(b);if(i){i.removeChild(f);g.removeChild(i)}else g.removeChild(f);return new OpenLayers.Size(d,e)};OpenLayers.Util.getScrollbarWidth=function(){var a=OpenLayers.Util._scrollbarWidth;if(a==null){var b=null,c=null,b=a=0,b=document.createElement("div");b.style.position="absolute";b.style.top="-1000px";b.style.left="-1000px";b.style.width="100px";b.style.height="50px";b.style.overflow="hidden";c=document.createElement("div");c.style.width="100%";c.style.height="200px";b.appendChild(c);document.body.appendChild(b);a=c.offsetWidth;b.style.overflow="scroll";b=c.offsetWidth;document.body.removeChild(document.body.lastChild);OpenLayers.Util._scrollbarWidth=a-b;a=OpenLayers.Util._scrollbarWidth}return a};OpenLayers.Util.getFormattedLonLat=function(a,b,c){c||(c="dms");var a=(a+540)%360-180,d=Math.abs(a),e=Math.floor(d),f=d=(d-e)/(1/60),d=Math.floor(d),f=Math.round((f-d)/(1/60)*10),f=f/10;if(f>=60){f=f-60;d=d+1;if(d>=60){d=d-60;e=e+1}}e<10&&(e="0"+e);e=e+"°";if(c.indexOf("dm")>=0){d<10&&(d="0"+d);e=e+(d+"'");if(c.indexOf("dms")>=0){f<10&&(f="0"+f);e=e+(f+'"')}}return e=b=="lon"?e+(a<0?OpenLayers.i18n("W"):OpenLayers.i18n("E")):e+(a<0?OpenLayers.i18n("S"):OpenLayers.i18n("N"))};OpenLayers.Format=OpenLayers.Class({options:null,externalProjection:null,internalProjection:null,data:null,keepData:!1,initialize:function(a){OpenLayers.Util.extend(this,a);this.options=a},destroy:function(){},read:function(){throw Error("Read not implemented.")},write:function(){throw Error("Write not implemented.")},CLASS_NAME:"OpenLayers.Format"});OpenLayers.Format.CSWGetRecords=function(a){var a=OpenLayers.Util.applyDefaults(a,OpenLayers.Format.CSWGetRecords.DEFAULTS),b=OpenLayers.Format.CSWGetRecords["v"+a.version.replace(/\./g,"_")];if(!b)throw"Unsupported CSWGetRecords version: "+a.version;return new b(a)};OpenLayers.Format.CSWGetRecords.DEFAULTS={version:"2.0.2"};OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:!1,displayClass:"",title:"",autoActivate:!1,active:null,handler:null,eventListeners:null,events:null,initialize:function(a){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,a);this.events=new OpenLayers.Events(this);if(this.eventListeners instanceof Object)this.events.on(this.eventListeners);null==this.id&&(this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_"))},destroy:function(){this.events&&(this.eventListeners&&this.events.un(this.eventListeners),this.events.destroy(),this.events=null);this.eventListeners=null;this.handler&&(this.handler.destroy(),this.handler=null);if(this.handlers){for(var a in this.handlers)this.handlers.hasOwnProperty(a)&&"function"==typeof this.handlers[a].destroy&&this.handlers[a].destroy();this.handlers=null}this.map&&(this.map.removeControl(this),this.map=null);this.div=null},setMap:function(a){this.map=a;this.handler&&this.handler.setMap(a)},draw:function(a){if(null==this.div&&(this.div=OpenLayers.Util.createDiv(this.id),this.div.className=this.displayClass,this.allowSelection||(this.div.className+=" olControlNoSelect",this.div.setAttribute("unselectable","on",0),this.div.onselectstart=OpenLayers.Function.False),""!=this.title))this.div.title=this.title;null!=a&&(this.position=a.clone());this.moveTo(this.position);return this.div},moveTo:function(a){null!=a&&null!=this.div&&(this.div.style.left=a.x+"px",this.div.style.top=a.y+"px")},activate:function(){if(this.active)return!1;this.handler&&this.handler.activate();this.active=!0;this.map&&OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active");this.events.triggerEvent("activate");return!0},deactivate:function(){return this.active?(this.handler&&this.handler.deactivate(),this.active=!1,this.map&&OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active"),this.events.triggerEvent("deactivate"),!0):!1},CLASS_NAME:"OpenLayers.Control"});OpenLayers.Control.TYPE_BUTTON=1;OpenLayers.Control.TYPE_TOGGLE=2;OpenLayers.Control.TYPE_TOOL=3;OpenLayers.Event={observers:!1,KEY_SPACE:32,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(a){return a.target||a.srcElement},isSingleTouch:function(a){return a.touches&&1==a.touches.length},isMultiTouch:function(a){return a.touches&&1<a.touches.length},isLeftClick:function(a){return a.which&&1==a.which||a.button&&1==a.button},isRightClick:function(a){return a.which&&3==a.which||a.button&&2==a.button},stop:function(a,b){b||(a.preventDefault?a.preventDefault():a.returnValue=!1);a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},findElement:function(a,b){for(var c=OpenLayers.Event.element(a);c.parentNode&&(!c.tagName||c.tagName.toUpperCase()!=b.toUpperCase());)c=c.parentNode;return c},observe:function(a,b,c,d){a=OpenLayers.Util.getElement(a);d=d||!1;if("keypress"==b&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||a.attachEvent))b="keydown";this.observers||(this.observers={});if(!a._eventCacheID){var e="eventCacheID_";a.id&&(e=a.id+"_"+e);a._eventCacheID=OpenLayers.Util.createUniqueID(e)}e=a._eventCacheID;this.observers[e]||(this.observers[e]=[]);this.observers[e].push({element:a,name:b,observer:c,useCapture:d});a.addEventListener?a.addEventListener(b,c,d):a.attachEvent&&a.attachEvent("on"+b,c)},stopObservingElement:function(a){a=OpenLayers.Util.getElement(a)._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[a])},_removeElementObservers:function(a){if(a)for(var b=a.length-1;0<=b;b--){var c=a[b];OpenLayers.Event.stopObserving.apply(this,[c.element,c.name,c.observer,c.useCapture])}},stopObserving:function(a,b,c,d){var d=d||!1,a=OpenLayers.Util.getElement(a),e=a._eventCacheID;if("keypress"==b&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||a.detachEvent))b="keydown";var f=!1,g=OpenLayers.Event.observers[e];if(g)for(var h=0;!f&&h<g.length;){var i=g[h];if(i.name==b&&i.observer==c&&i.useCapture==d){g.splice(h,1);0==g.length&&delete OpenLayers.Event.observers[e];f=!0;break}h++}f&&(a.removeEventListener?a.removeEventListener(b,c,d):a&&a.detachEvent&&a.detachEvent("on"+b,c));return f},unloadCache:function(){if(OpenLayers.Event&&OpenLayers.Event.observers){for(var a in OpenLayers.Event.observers)OpenLayers.Event._removeElementObservers.apply(this,[OpenLayers.Event.observers[a]]);OpenLayers.Event.observers=!1}},CLASS_NAME:"OpenLayers.Event"};OpenLayers.Event.observe(window,"unload",OpenLayers.Event.unloadCache,!1);OpenLayers.Events=OpenLayers.Class({BROWSER_EVENTS:"mouseover mouseout mousedown mouseup mousemove click dblclick rightclick dblrightclick resize focus blur touchstart touchmove touchend keydown".split(" "),listeners:null,object:null,element:null,eventHandler:null,fallThrough:null,includeXY:!1,extensions:null,extensionCount:null,clearMouseListener:null,initialize:function(a,b,c,d,e){OpenLayers.Util.extend(this,e);this.object=a;this.fallThrough=d;this.listeners={};this.extensions={};this.extensionCount={};null!=b&&this.attachToElement(b)},destroy:function(){for(var a in this.extensions)"boolean"!==typeof this.extensions[a]&&this.extensions[a].destroy();this.extensions=null;this.element&&(OpenLayers.Event.stopObservingElement(this.element),this.element.hasScrollEvent&&OpenLayers.Event.stopObserving(window,"scroll",this.clearMouseListener));this.eventHandler=this.fallThrough=this.object=this.listeners=this.element=null},addEventType:function(){},attachToElement:function(a){this.element?OpenLayers.Event.stopObservingElement(this.element):(this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,this),this.clearMouseListener=OpenLayers.Function.bind(this.clearMouseCache,this));this.element=a;for(var b=0,c=this.BROWSER_EVENTS.length;b<c;b++)OpenLayers.Event.observe(a,this.BROWSER_EVENTS[b],this.eventHandler);OpenLayers.Event.observe(a,"dragstart",OpenLayers.Event.stop)},on:function(a){for(var b in a)"scope"!=b&&a.hasOwnProperty(b)&&this.register(b,a.scope,a[b])},register:function(a,b,c,d){a in OpenLayers.Events&&!this.extensions[a]&&(this.extensions[a]=new OpenLayers.Events[a](this));if(null!=c){null==b&&(b=this.object);var e=this.listeners[a];e||(e=[],this.listeners[a]=e,this.extensionCount[a]=0);b={obj:b,func:c};d?(e.splice(this.extensionCount[a],0,b),"object"===typeof d&&d.extension&&this.extensionCount[a]++):e.push(b)}},registerPriority:function(a,b,c){this.register(a,b,c,!0)},un:function(a){for(var b in a)"scope"!=b&&a.hasOwnProperty(b)&&this.unregister(b,a.scope,a[b])},unregister:function(a,b,c){null==b&&(b=this.object);a=this.listeners[a];if(null!=a)for(var d=0,e=a.length;d<e;d++)if(a[d].obj==b&&a[d].func==c){a.splice(d,1);break}},remove:function(a){null!=this.listeners[a]&&(this.listeners[a]=[])},triggerEvent:function(a,b){var c=this.listeners[a];if(c&&0!=c.length){null==b&&(b={});b.object=this.object;b.element=this.element;b.type||(b.type=a);for(var c=c.slice(),d,e=0,f=c.length;e<f&&!(d=c[e],d=d.func.apply(d.obj,[b]),void 0!=d&&!1==d);e++);this.fallThrough||OpenLayers.Event.stop(b,!0);return d}},handleBrowserEvent:function(a){var b=a.type,c=this.listeners[b];if(c&&0!=c.length){if((c=a.touches)&&c[0]){for(var d=0,e=0,f=c.length,g,h=0;h<f;++h)g=c[h],d+=g.clientX,e+=g.clientY;a.clientX=d/f;a.clientY=e/f}this.includeXY&&(a.xy=this.getMousePosition(a));this.triggerEvent(b,a)}},clearMouseCache:function(){this.element.scrolls=null;this.element.lefttop=null;var a=document.body;if(a&&(!(0!=a.scrollTop||0!=a.scrollLeft)||!navigator.userAgent.match(/iPhone/i)))this.element.offsets=null},getMousePosition:function(a){this.includeXY?this.element.hasScrollEvent||(OpenLayers.Event.observe(window,"scroll",this.clearMouseListener),this.element.hasScrollEvent=!0):this.clearMouseCache();if(!this.element.scrolls){var b=OpenLayers.Util.getViewportElement();this.element.scrolls=[b.scrollLeft,b.scrollTop]}this.element.lefttop||(this.element.lefttop=[document.documentElement.clientLeft||0,document.documentElement.clientTop||0]);this.element.offsets||(this.element.offsets=OpenLayers.Util.pagePosition(this.element));return new OpenLayers.Pixel(a.clientX+this.element.scrolls[0]-this.element.offsets[0]-this.element.lefttop[0],a.clientY+this.element.scrolls[1]-this.element.offsets[1]-this.element.lefttop[1])},CLASS_NAME:"OpenLayers.Events"});OpenLayers.Events.buttonclick=OpenLayers.Class({target:null,events:"mousedown mouseup click dblclick touchstart touchmove touchend keydown".split(" "),startRegEx:/^mousedown|touchstart$/,cancelRegEx:/^touchmove$/,completeRegEx:/^mouseup|touchend$/,initialize:function(a){this.target=a;for(a=this.events.length-1;0<=a;--a)this.target.register(this.events[a],this,this.buttonClick,{extension:!0})},destroy:function(){for(var a=this.events.length-1;0<=a;--a)this.target.unregister(this.events[a],this,this.buttonClick);delete this.target},getPressedButton:function(a){var b=3,c;do{if(OpenLayers.Element.hasClass(a,"olButton")){c=a;break}a=a.parentNode}while(0<--b&&a);return c},buttonClick:function(a){var b=!0,c=OpenLayers.Event.element(a);if(c&&(OpenLayers.Event.isLeftClick(a)||!~a.type.indexOf("mouse")))if(c=this.getPressedButton(c)){if("keydown"===a.type)switch(a.keyCode){case OpenLayers.Event.KEY_RETURN:case OpenLayers.Event.KEY_SPACE:this.target.triggerEvent("buttonclick",{buttonElement:c}),OpenLayers.Event.stop(a),b=!1}else this.startEvt&&(this.completeRegEx.test(a.type)&&(b=OpenLayers.Util.pagePosition(c),this.target.triggerEvent("buttonclick",{buttonElement:c,buttonXY:{x:this.startEvt.clientX-b[0],y:this.startEvt.clientY-b[1]}})),this.cancelRegEx.test(a.type)&&delete this.startEvt,OpenLayers.Event.stop(a),b=!1);this.startRegEx.test(a.type)&&(this.startEvt=a,OpenLayers.Event.stop(a),b=!1)}else delete this.startEvt;return b}});OpenLayers.Control.OverviewMap=OpenLayers.Class(OpenLayers.Control,{element:null,ovmap:null,size:{w:180,h:90},layers:null,minRectSize:15,minRectDisplayClass:"RectReplacement",minRatio:8,maxRatio:32,mapOptions:null,autoPan:!1,handlers:null,resolutionFactor:1,maximized:!1,initialize:function(a){this.layers=[];this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,[a])},destroy:function(){this.mapDiv&&(this.handlers.click&&this.handlers.click.destroy(),this.handlers.drag&&this.handlers.drag.destroy(),this.ovmap&&this.ovmap.viewPortDiv.removeChild(this.extentRectangle),this.extentRectangle=null,this.rectEvents&&(this.rectEvents.destroy(),this.rectEvents=null),this.ovmap&&(this.ovmap.destroy(),this.ovmap=null),this.element.removeChild(this.mapDiv),this.mapDiv=null,this.div.removeChild(this.element),this.element=null,this.maximizeDiv&&(this.div.removeChild(this.maximizeDiv),this.maximizeDiv=null),this.minimizeDiv&&(this.div.removeChild(this.minimizeDiv),this.minimizeDiv=null),this.map.events.un({buttonclick:this.onButtonClick,moveend:this.update,changebaselayer:this.baseLayerDraw,scope:this}),OpenLayers.Control.prototype.destroy.apply(this,arguments))},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(0===this.layers.length)if(this.map.baseLayer)this.layers=[this.map.baseLayer.clone()];else return this.map.events.register("changebaselayer",this,this.baseLayerDraw),this.div;this.element=document.createElement("div");this.element.className=this.displayClass+"Element";this.element.style.display="none";this.mapDiv=document.createElement("div");this.mapDiv.style.width=this.size.w+"px";this.mapDiv.style.height=this.size.h+"px";this.mapDiv.style.position="relative";this.mapDiv.style.overflow="hidden";this.mapDiv.id=OpenLayers.Util.createUniqueID("overviewMap");this.extentRectangle=document.createElement("div");this.extentRectangle.style.position="absolute";this.extentRectangle.style.zIndex=1e3;this.extentRectangle.className=this.displayClass+"ExtentRectangle";this.element.appendChild(this.mapDiv);this.div.appendChild(this.element);if(this.outsideViewport)this.element.style.display="";else{this.div.className+=" "+this.displayClass+"Container";var a=OpenLayers.Util.getImageLocation("layer-switcher-maximize.png");this.maximizeDiv=OpenLayers.Util.createAlphaImageDiv(this.displayClass+"MaximizeButton",null,null,a,"absolute");this.maximizeDiv.style.display="none";this.maximizeDiv.className=this.displayClass+"MaximizeButton olButton";this.div.appendChild(this.maximizeDiv);a=OpenLayers.Util.getImageLocation("layer-switcher-minimize.png");this.minimizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_minimizeDiv",null,null,a,"absolute");this.minimizeDiv.style.display="none";this.minimizeDiv.className=this.displayClass+"MinimizeButton olButton";this.div.appendChild(this.minimizeDiv);this.minimizeControl()}this.map.getExtent()&&this.update();this.map.events.on({buttonclick:this.onButtonClick,moveend:this.update,scope:this});this.maximized&&this.maximizeControl();return this.div},baseLayerDraw:function(){this.draw();this.map.events.unregister("changebaselayer",this,this.baseLayerDraw)},rectDrag:function(a){var b=this.handlers.drag.last.x-a.x,c=this.handlers.drag.last.y-a.y;if(0!=b||0!=c){var d=this.rectPxBounds.top,e=this.rectPxBounds.left,a=Math.abs(this.rectPxBounds.getHeight()),f=this.rectPxBounds.getWidth(),c=Math.max(0,d-c),c=Math.min(c,this.ovmap.size.h-this.hComp-a),b=Math.max(0,e-b),b=Math.min(b,this.ovmap.size.w-this.wComp-f);this.setRectPxBounds(new OpenLayers.Bounds(b,c+a,b+f,c))}},mapDivClick:function(a){var b=this.rectPxBounds.getCenterPixel(),c=a.xy.x-b.x,d=a.xy.y-b.y,e=this.rectPxBounds.top,f=this.rectPxBounds.left,a=Math.abs(this.rectPxBounds.getHeight()),b=this.rectPxBounds.getWidth(),d=Math.max(0,e+d),d=Math.min(d,this.ovmap.size.h-a),c=Math.max(0,f+c),c=Math.min(c,this.ovmap.size.w-b);this.setRectPxBounds(new OpenLayers.Bounds(c,d+a,c+b,d));this.updateMapToRect()},onButtonClick:function(a){a.buttonElement===this.minimizeDiv?this.minimizeControl():a.buttonElement===this.maximizeDiv&&this.maximizeControl()},maximizeControl:function(a){this.element.style.display="";this.showToggle(!1);null!=a&&OpenLayers.Event.stop(a)},minimizeControl:function(a){this.element.style.display="none";this.showToggle(!0);null!=a&&OpenLayers.Event.stop(a)},showToggle:function(a){this.maximizeDiv.style.display=a?"":"none";this.minimizeDiv.style.display=a?"none":""},update:function(){null==this.ovmap&&this.createMap();(this.autoPan||!this.isSuitableOverview())&&this.updateOverview();this.updateRectToMap()},isSuitableOverview:function(){var a=this.map.getExtent(),b=this.map.maxExtent,a=new OpenLayers.Bounds(Math.max(a.left,b.left),Math.max(a.bottom,b.bottom),Math.min(a.right,b.right),Math.min(a.top,b.top));this.ovmap.getProjection()!=this.map.getProjection()&&(a=a.transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject()));b=this.ovmap.getResolution()/this.map.getResolution();return b>this.minRatio&&b<=this.maxRatio&&this.ovmap.getExtent().containsBounds(a)},updateOverview:function(){var a=this.map.getResolution(),b=this.ovmap.getResolution(),c=b/a;c>this.maxRatio?b=this.minRatio*a:c<=this.minRatio&&(b=this.maxRatio*a);this.ovmap.getProjection()!=this.map.getProjection()?(a=this.map.center.clone(),a.transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject())):a=this.map.center;this.ovmap.setCenter(a,this.ovmap.getZoomForResolution(b*this.resolutionFactor));this.updateRectToMap()},createMap:function(){var a=OpenLayers.Util.extend({controls:[],maxResolution:"auto",fallThrough:!1},this.mapOptions);this.ovmap=new OpenLayers.Map(this.mapDiv,a);this.ovmap.viewPortDiv.appendChild(this.extentRectangle);OpenLayers.Event.stopObserving(window,"unload",this.ovmap.unloadDestroy);this.ovmap.addLayers(this.layers);this.ovmap.zoomToMaxExtent();this.wComp=(this.wComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-right-width")))?this.wComp:2;this.hComp=(this.hComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-top-width"))+parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-bottom-width")))?this.hComp:2;this.handlers.drag=new OpenLayers.Handler.Drag(this,{move:this.rectDrag,done:this.updateMapToRect},{map:this.ovmap});this.handlers.click=new OpenLayers.Handler.Click(this,{click:this.mapDivClick},{single:!0,"double":!1,stopSingle:!0,stopDouble:!0,pixelTolerance:1,map:this.ovmap});this.handlers.click.activate();this.rectEvents=new OpenLayers.Events(this,this.extentRectangle,null,!0);this.rectEvents.register("mouseover",this,function(){!this.handlers.drag.active&&!this.map.dragging&&this.handlers.drag.activate()});this.rectEvents.register("mouseout",this,function(){this.handlers.drag.dragging||this.handlers.drag.deactivate()});if(this.ovmap.getProjection()!=this.map.getProjection()){var a=this.map.getProjectionObject().getUnits()||this.map.units||this.map.baseLayer.units,b=this.ovmap.getProjectionObject().getUnits()||this.ovmap.units||this.ovmap.baseLayer.units;this.resolutionFactor=a&&b?OpenLayers.INCHES_PER_UNIT[a]/OpenLayers.INCHES_PER_UNIT[b]:1}},updateRectToMap:function(){var a=this.getRectBoundsFromMapBounds(this.ovmap.getProjection()!=this.map.getProjection()?this.map.getExtent().transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject()):this.map.getExtent());a&&this.setRectPxBounds(a)},updateMapToRect:function(){var a=this.getMapBoundsFromRectBounds(this.rectPxBounds);this.ovmap.getProjection()!=this.map.getProjection()&&(a=a.transform(this.ovmap.getProjectionObject(),this.map.getProjectionObject()));this.map.panTo(a.getCenterLonLat())},setRectPxBounds:function(a){var b=Math.max(a.top,0),c=Math.max(a.left,0),d=Math.min(a.top+Math.abs(a.getHeight()),this.ovmap.size.h-this.hComp),a=Math.min(a.left+a.getWidth(),this.ovmap.size.w-this.wComp),e=Math.max(a-c,0),f=Math.max(d-b,0);e<this.minRectSize||f<this.minRectSize?(this.extentRectangle.className=this.displayClass+this.minRectDisplayClass,e=c+e/2-this.minRectSize/2,this.extentRectangle.style.top=Math.round(b+f/2-this.minRectSize/2)+"px",this.extentRectangle.style.left=Math.round(e)+"px",this.extentRectangle.style.height=this.minRectSize+"px",this.extentRectangle.style.width=this.minRectSize+"px"):(this.extentRectangle.className=this.displayClass+"ExtentRectangle",this.extentRectangle.style.top=Math.round(b)+"px",this.extentRectangle.style.left=Math.round(c)+"px",this.extentRectangle.style.height=Math.round(f)+"px",this.extentRectangle.style.width=Math.round(e)+"px");this.rectPxBounds=new OpenLayers.Bounds(Math.round(c),Math.round(d),Math.round(a),Math.round(b))},getRectBoundsFromMapBounds:function(a){var b=this.getOverviewPxFromLonLat({lon:a.left,lat:a.bottom}),a=this.getOverviewPxFromLonLat({lon:a.right,lat:a.top}),c=null;b&&a&&(c=new OpenLayers.Bounds(b.x,b.y,a.x,a.y));return c},getMapBoundsFromRectBounds:function(a){var b=this.getLonLatFromOverviewPx({x:a.left,y:a.bottom}),a=this.getLonLatFromOverviewPx({x:a.right,y:a.top});return new OpenLayers.Bounds(b.lon,b.lat,a.lon,a.lat)},getLonLatFromOverviewPx:function(a){var b=this.ovmap.size,c=this.ovmap.getResolution(),d=this.ovmap.getExtent().getCenterLonLat();return{lon:d.lon+(a.x-b.w/2)*c,lat:d.lat-(a.y-b.h/2)*c}},getOverviewPxFromLonLat:function(a){var b=this.ovmap.getResolution(),c=this.ovmap.getExtent();if(c)return{x:Math.round(1/b*(a.lon-c.left)),y:Math.round(1/b*(c.top-a.lat))}},CLASS_NAME:"OpenLayers.Control.OverviewMap"});OpenLayers.Animation=function(a){var b=!(!a.requestAnimationFrame&&!a.webkitRequestAnimationFrame&&!a.mozRequestAnimationFrame&&!a.oRequestAnimationFrame&&!a.msRequestAnimationFrame),c=function(){var b=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame||a.msRequestAnimationFrame||function(b){a.setTimeout(b,16)};return function(c,d){b.apply(a,[c,d])}}(),d=0,e={};return{isNative:b,requestFrame:c,start:function(a,b,h){var b=0<b?b:Number.POSITIVE_INFINITY,i=++d,j=+new Date;e[i]=function(){e[i]&&+new Date-j<=b?(a(),e[i]&&c(e[i],h)):delete e[i];
};c(e[i],h);return i},stop:function(a){delete e[a]}}}(window);OpenLayers.Tween=OpenLayers.Class({easing:null,begin:null,finish:null,duration:null,callbacks:null,time:null,animationId:null,playing:!1,initialize:function(a){this.easing=a?a:OpenLayers.Easing.Expo.easeOut},start:function(a,b,c,d){this.playing=!0;this.begin=a;this.finish=b;this.duration=c;this.callbacks=d.callbacks;this.time=0;OpenLayers.Animation.stop(this.animationId);this.animationId=null;this.callbacks&&this.callbacks.start&&this.callbacks.start.call(this,this.begin);this.animationId=OpenLayers.Animation.start(OpenLayers.Function.bind(this.play,this))},stop:function(){this.playing&&(this.callbacks&&this.callbacks.done&&this.callbacks.done.call(this,this.finish),OpenLayers.Animation.stop(this.animationId),this.animationId=null,this.playing=!1)},play:function(){var a={},b;for(b in this.begin){var c=this.begin[b],d=this.finish[b];if(null==c||null==d||isNaN(c)||isNaN(d))throw new TypeError("invalid value for Tween");a[b]=this.easing.apply(this,[this.time,c,d-c,this.duration])}this.time++;this.callbacks&&this.callbacks.eachStep&&this.callbacks.eachStep.call(this,a);this.time>this.duration&&this.stop()},CLASS_NAME:"OpenLayers.Tween"});OpenLayers.Easing={CLASS_NAME:"OpenLayers.Easing"};OpenLayers.Easing.Linear={easeIn:function(a,b,c,d){return c*a/d+b},easeOut:function(a,b,c,d){return c*a/d+b},easeInOut:function(a,b,c,d){return c*a/d+b},CLASS_NAME:"OpenLayers.Easing.Linear"};OpenLayers.Easing.Expo={easeIn:function(a,b,c,d){return 0==a?b:c*Math.pow(2,10*(a/d-1))+b},easeOut:function(a,b,c,d){return a==d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b},easeInOut:function(a,b,c,d){return 0==a?b:a==d?b+c:1>(a/=d/2)?c/2*Math.pow(2,10*(a-1))+b:c/2*(-Math.pow(2,-10*--a)+2)+b},CLASS_NAME:"OpenLayers.Easing.Expo"};OpenLayers.Easing.Quad={easeIn:function(a,b,c,d){return c*(a/=d)*a+b},easeOut:function(a,b,c,d){return-c*(a/=d)*(a-2)+b},easeInOut:function(a,b,c,d){return 1>(a/=d/2)?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b},CLASS_NAME:"OpenLayers.Easing.Quad"};OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,titleRegEx:/\+title=[^\+]*/,initialize:function(a,b){OpenLayers.Util.extend(this,b);this.projCode=a;window.Proj4js&&(this.proj=new Proj4js.Proj(a))},getCode:function(){return this.proj?this.proj.srsCode:this.projCode},getUnits:function(){return this.proj?this.proj.units:null},toString:function(){return this.getCode()},equals:function(a){var b=!1;a&&(a instanceof OpenLayers.Projection||(a=new OpenLayers.Projection(a)),window.Proj4js&&this.proj.defData&&a.proj.defData?b=this.proj.defData.replace(this.titleRegEx,"")==a.proj.defData.replace(this.titleRegEx,""):a.getCode&&(b=this.getCode(),a=a.getCode(),b=b==a||!!OpenLayers.Projection.transforms[b]&&OpenLayers.Projection.transforms[b][a]===OpenLayers.Projection.nullTransform));return b},destroy:function(){delete this.proj;delete this.projCode},CLASS_NAME:"OpenLayers.Projection"});OpenLayers.Projection.transforms={};OpenLayers.Projection.defaults={"EPSG:4326":{units:"degrees",maxExtent:[-180,-90,180,90],yx:!0},"CRS:84":{units:"degrees",maxExtent:[-180,-90,180,90]},"EPSG:900913":{units:"m",maxExtent:[-20037508.34,-20037508.34,20037508.34,20037508.34]}};OpenLayers.Projection.addTransform=function(a,b,c){if(c===OpenLayers.Projection.nullTransform){var d=OpenLayers.Projection.defaults[a];d&&!OpenLayers.Projection.defaults[b]&&(OpenLayers.Projection.defaults[b]=d)}OpenLayers.Projection.transforms[a]||(OpenLayers.Projection.transforms[a]={});OpenLayers.Projection.transforms[a][b]=c};OpenLayers.Projection.transform=function(a,b,c){if(b&&c)if(b instanceof OpenLayers.Projection||(b=new OpenLayers.Projection(b)),c instanceof OpenLayers.Projection||(c=new OpenLayers.Projection(c)),b.proj&&c.proj)a=Proj4js.transform(b.proj,c.proj,a);else{var b=b.getCode(),c=c.getCode(),d=OpenLayers.Projection.transforms;if(d[b]&&d[b][c])d[b][c](a)}return a};OpenLayers.Projection.nullTransform=function(a){return a};(function(){function a(a){a.x=180*a.x/d;a.y=180/Math.PI*(2*Math.atan(Math.exp(a.y/d*Math.PI))-Math.PI/2);return a}function b(a){a.x=a.x*d/180;a.y=Math.log(Math.tan((90+a.y)*Math.PI/360))/Math.PI*d;return a}function c(c,d){var e=OpenLayers.Projection.addTransform,f=OpenLayers.Projection.nullTransform,g,m,n,o,p;g=0;for(m=d.length;g<m;++g){n=d[g];e(c,n,b);e(n,c,a);for(p=g+1;p<m;++p)o=d[p],e(n,o,f),e(o,n,f)}}var d=20037508.34,e=["EPSG:900913","EPSG:3857","EPSG:102113","EPSG:102100"],f=["CRS:84","urn:ogc:def:crs:EPSG:6.6:4326","EPSG:4326"],g;for(g=e.length-1;0<=g;--g)c(e[g],f);for(g=f.length-1;0<=g;--g)c(f[g],e)})();OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1e3},id:null,fractionalZoom:!1,events:null,allOverlays:!1,div:null,dragging:!1,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,layers:null,controls:null,popups:null,baseLayer:null,center:null,resolution:null,zoom:0,panRatio:1.5,options:null,tileSize:null,projection:"EPSG:4326",units:null,resolutions:null,maxResolution:null,minResolution:null,maxScale:null,minScale:null,maxExtent:null,minExtent:null,restrictedExtent:null,numZoomLevels:16,theme:null,displayProjection:null,fallThrough:!0,panTween:null,eventListeners:null,panMethod:OpenLayers.Easing.Expo.easeOut,panDuration:50,paddingForPopups:null,minPx:null,maxPx:null,initialize:function(a,b){1===arguments.length&&"object"===typeof a&&(a=(b=a)&&b.div);this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.paddingForPopups=new OpenLayers.Bounds(15,15,15,15);this.theme=OpenLayers._getScriptLocation()+"theme/default/style.css";this.options=OpenLayers.Util.extend({},b);OpenLayers.Util.extend(this,b);OpenLayers.Util.applyDefaults(this,OpenLayers.Projection.defaults[this.projection instanceof OpenLayers.Projection?this.projection.projCode:this.projection]);this.maxExtent&&!(this.maxExtent instanceof OpenLayers.Bounds)&&(this.maxExtent=new OpenLayers.Bounds(this.maxExtent));this.minExtent&&!(this.minExtent instanceof OpenLayers.Bounds)&&(this.minExtent=new OpenLayers.Bounds(this.minExtent));this.restrictedExtent&&!(this.restrictedExtent instanceof OpenLayers.Bounds)&&(this.restrictedExtent=new OpenLayers.Bounds(this.restrictedExtent));this.center&&!(this.center instanceof OpenLayers.LonLat)&&(this.center=new OpenLayers.LonLat(this.center));this.layers=[];this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_");this.div=OpenLayers.Util.getElement(a);this.div||(this.div=document.createElement("div"),this.div.style.height="1px",this.div.style.width="1px");OpenLayers.Element.addClass(this.div,"olMap");var c=this.id+"_OpenLayers_ViewPort";this.viewPortDiv=OpenLayers.Util.createDiv(c,null,null,null,"relative",null,"hidden");this.viewPortDiv.style.width="100%";this.viewPortDiv.style.height="100%";this.viewPortDiv.className="olMapViewport";this.div.appendChild(this.viewPortDiv);this.events=new OpenLayers.Events(this,this.viewPortDiv,null,this.fallThrough,{includeXY:!0});c=this.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(c);this.layerContainerDiv.style.width="100px";this.layerContainerDiv.style.height="100px";this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE.Popup-1;this.viewPortDiv.appendChild(this.layerContainerDiv);this.updateSize();if(this.eventListeners instanceof Object)this.events.on(this.eventListeners);9>parseFloat(navigator.appVersion.split("MSIE")[1])?this.events.register("resize",this,this.updateSize):(this.updateSizeDestroy=OpenLayers.Function.bind(this.updateSize,this),OpenLayers.Event.observe(window,"resize",this.updateSizeDestroy));if(this.theme){for(var c=!0,d=document.getElementsByTagName("link"),e=0,f=d.length;e<f;++e)if(OpenLayers.Util.isEquivalentUrl(d.item(e).href,this.theme)){c=!1;break}c&&(c=document.createElement("link"),c.setAttribute("rel","stylesheet"),c.setAttribute("type","text/css"),c.setAttribute("href",this.theme),document.getElementsByTagName("head")[0].appendChild(c))}null==this.controls&&(this.controls=[],null!=OpenLayers.Control&&(OpenLayers.Control.Navigation?this.controls.push(new OpenLayers.Control.Navigation):OpenLayers.Control.TouchNavigation&&this.controls.push(new OpenLayers.Control.TouchNavigation),OpenLayers.Control.Zoom?this.controls.push(new OpenLayers.Control.Zoom):OpenLayers.Control.PanZoom&&this.controls.push(new OpenLayers.Control.PanZoom),OpenLayers.Control.ArgParser&&this.controls.push(new OpenLayers.Control.ArgParser),OpenLayers.Control.Attribution&&this.controls.push(new OpenLayers.Control.Attribution)));e=0;for(f=this.controls.length;e<f;e++)this.addControlToMap(this.controls[e]);this.popups=[];this.unloadDestroy=OpenLayers.Function.bind(this.destroy,this);OpenLayers.Event.observe(window,"unload",this.unloadDestroy);b&&b.layers&&(delete this.center,this.addLayers(b.layers),b.center&&!this.getCenter()&&this.setCenter(b.center,b.zoom))},getViewport:function(){return this.viewPortDiv},render:function(a){this.div=OpenLayers.Util.getElement(a);OpenLayers.Element.addClass(this.div,"olMap");this.viewPortDiv.parentNode.removeChild(this.viewPortDiv);this.div.appendChild(this.viewPortDiv);this.updateSize()},unloadDestroy:null,updateSizeDestroy:null,destroy:function(){if(!this.unloadDestroy)return!1;this.panTween&&(this.panTween.stop(),this.panTween=null);OpenLayers.Event.stopObserving(window,"unload",this.unloadDestroy);this.unloadDestroy=null;this.updateSizeDestroy?OpenLayers.Event.stopObserving(window,"resize",this.updateSizeDestroy):this.events.unregister("resize",this,this.updateSize);this.paddingForPopups=null;if(null!=this.controls){for(var a=this.controls.length-1;0<=a;--a)this.controls[a].destroy();this.controls=null}if(null!=this.layers){for(a=this.layers.length-1;0<=a;--a)this.layers[a].destroy(!1);this.layers=null}this.viewPortDiv&&this.div.removeChild(this.viewPortDiv);this.viewPortDiv=null;this.eventListeners&&(this.events.un(this.eventListeners),this.eventListeners=null);this.events.destroy();this.options=this.events=null},setOptions:function(a){var b=this.minPx&&a.restrictedExtent!=this.restrictedExtent;OpenLayers.Util.extend(this,a);b&&this.moveTo(this.getCachedCenter(),this.zoom,{forceZoomChange:!0})},getTileSize:function(){return this.tileSize},getBy:function(a,b,c){var d="function"==typeof c.test;return OpenLayers.Array.filter(this[a],function(a){return a[b]==c||d&&c.test(a[b])})},getLayersBy:function(a,b){return this.getBy("layers",a,b)},getLayersByName:function(a){return this.getLayersBy("name",a)},getLayersByClass:function(a){return this.getLayersBy("CLASS_NAME",a)},getControlsBy:function(a,b){return this.getBy("controls",a,b)},getControlsByClass:function(a){return this.getControlsBy("CLASS_NAME",a)},getLayer:function(a){for(var b=null,c=0,d=this.layers.length;c<d;c++){var e=this.layers[c];if(e.id==a){b=e;break}}return b},setLayerZIndex:function(a,b){a.setZIndex(this.Z_INDEX_BASE[a.isBaseLayer?"BaseLayer":"Overlay"]+5*b)},resetLayersZIndex:function(){for(var a=0,b=this.layers.length;a<b;a++)this.setLayerZIndex(this.layers[a],a)},addLayer:function(a){for(var b=0,c=this.layers.length;b<c;b++)if(this.layers[b]==a)return!1;if(!1===this.events.triggerEvent("preaddlayer",{layer:a}))return!1;this.allOverlays&&(a.isBaseLayer=!1);a.div.className="olLayerDiv";a.div.style.overflow="";this.setLayerZIndex(a,this.layers.length);a.isFixed?this.viewPortDiv.appendChild(a.div):this.layerContainerDiv.appendChild(a.div);this.layers.push(a);a.setMap(this);a.isBaseLayer||this.allOverlays&&!this.baseLayer?null==this.baseLayer?this.setBaseLayer(a):a.setVisibility(!1):a.redraw();this.events.triggerEvent("addlayer",{layer:a});a.events.triggerEvent("added",{map:this,layer:a});a.afterAdd();return!0},addLayers:function(a){for(var b=0,c=a.length;b<c;b++)this.addLayer(a[b])},removeLayer:function(a,b){if(!1!==this.events.triggerEvent("preremovelayer",{layer:a})){null==b&&(b=!0);a.isFixed?this.viewPortDiv.removeChild(a.div):this.layerContainerDiv.removeChild(a.div);OpenLayers.Util.removeItem(this.layers,a);a.removeMap(this);a.map=null;if(this.baseLayer==a&&(this.baseLayer=null,b))for(var c=0,d=this.layers.length;c<d;c++){var e=this.layers[c];if(e.isBaseLayer||this.allOverlays){this.setBaseLayer(e);break}}this.resetLayersZIndex();this.events.triggerEvent("removelayer",{layer:a});a.events.triggerEvent("removed",{map:this,layer:a})}},getNumLayers:function(){return this.layers.length},getLayerIndex:function(a){return OpenLayers.Util.indexOf(this.layers,a)},setLayerIndex:function(a,b){var c=this.getLayerIndex(a);0>b?b=0:b>this.layers.length&&(b=this.layers.length);if(c!=b){this.layers.splice(c,1);this.layers.splice(b,0,a);for(var c=0,d=this.layers.length;c<d;c++)this.setLayerZIndex(this.layers[c],c);this.events.triggerEvent("changelayer",{layer:a,property:"order"});this.allOverlays&&(0===b?this.setBaseLayer(a):this.baseLayer!==this.layers[0]&&this.setBaseLayer(this.layers[0]))}},raiseLayer:function(a,b){var c=this.getLayerIndex(a)+b;this.setLayerIndex(a,c)},setBaseLayer:function(a){if(a!=this.baseLayer&&-1!=OpenLayers.Util.indexOf(this.layers,a)){var b=this.getCachedCenter(),c=OpenLayers.Util.getResolutionFromScale(this.getScale(),a.units);null!=this.baseLayer&&!this.allOverlays&&this.baseLayer.setVisibility(!1);this.baseLayer=a;if(!this.allOverlays||this.baseLayer.visibility)this.baseLayer.setVisibility(!0),!1===this.baseLayer.inRange&&this.baseLayer.redraw();null!=b&&(a=this.getZoomForResolution(c||this.resolution,!0),this.setCenter(b,a,!1,!0));this.events.triggerEvent("changebaselayer",{layer:this.baseLayer})}},addControl:function(a,b){this.controls.push(a);this.addControlToMap(a,b)},addControls:function(a,b){for(var c=1===arguments.length?[]:b,d=0,e=a.length;d<e;d++)this.addControl(a[d],c[d]?c[d]:null)},addControlToMap:function(a,b){a.outsideViewport=null!=a.div;this.displayProjection&&!a.displayProjection&&(a.displayProjection=this.displayProjection);a.setMap(this);var c=a.draw(b);c&&!a.outsideViewport&&(c.style.zIndex=this.Z_INDEX_BASE.Control+this.controls.length,this.viewPortDiv.appendChild(c));a.autoActivate&&a.activate()},getControl:function(a){for(var b=null,c=0,d=this.controls.length;c<d;c++){var e=this.controls[c];if(e.id==a){b=e;break}}return b},removeControl:function(a){a&&a==this.getControl(a.id)&&(a.div&&a.div.parentNode==this.viewPortDiv&&this.viewPortDiv.removeChild(a.div),OpenLayers.Util.removeItem(this.controls,a))},addPopup:function(a,b){if(b)for(var c=this.popups.length-1;0<=c;--c)this.removePopup(this.popups[c]);a.map=this;this.popups.push(a);if(c=a.draw())c.style.zIndex=this.Z_INDEX_BASE.Popup+this.popups.length,this.layerContainerDiv.appendChild(c)},removePopup:function(a){OpenLayers.Util.removeItem(this.popups,a);if(a.div)try{this.layerContainerDiv.removeChild(a.div)}catch(b){}a.map=null},getSize:function(){var a=null;null!=this.size&&(a=this.size.clone());return a},updateSize:function(){var a=this.getCurrentSize();if(a&&!isNaN(a.h)&&!isNaN(a.w)){this.events.clearMouseCache();var b=this.getSize();null==b&&(this.size=b=a);if(!a.equals(b)){this.size=a;a=0;for(b=this.layers.length;a<b;a++)this.layers[a].onMapResize();a=this.getCachedCenter();null!=this.baseLayer&&null!=a&&(b=this.getZoom(),this.zoom=null,this.setCenter(a,b))}}},getCurrentSize:function(){var a=new OpenLayers.Size(this.div.clientWidth,this.div.clientHeight);if(0==a.w&&0==a.h||isNaN(a.w)&&isNaN(a.h))a.w=this.div.offsetWidth,a.h=this.div.offsetHeight;if(0==a.w&&0==a.h||isNaN(a.w)&&isNaN(a.h))a.w=parseInt(this.div.style.width),a.h=parseInt(this.div.style.height);return a},calculateBounds:function(a,b){var c=null;null==a&&(a=this.getCachedCenter());null==b&&(b=this.getResolution());if(null!=a&&null!=b)var c=this.size.w*b/2,d=this.size.h*b/2,c=new OpenLayers.Bounds(a.lon-c,a.lat-d,a.lon+c,a.lat+d);return c},getCenter:function(){var a=null,b=this.getCachedCenter();b&&(a=b.clone());return a},getCachedCenter:function(){!this.center&&this.size&&(this.center=this.getLonLatFromViewPortPx({x:this.size.w/2,y:this.size.h/2}));return this.center},getZoom:function(){return this.zoom},pan:function(a,b,c){c=OpenLayers.Util.applyDefaults(c,{animate:!0,dragging:!1});if(c.dragging)(0!=a||0!=b)&&this.moveByPx(a,b);else{var d=this.getViewPortPxFromLonLat(this.getCachedCenter()),a=d.add(a,b);if(this.dragging||!a.equals(d))d=this.getLonLatFromViewPortPx(a),c.animate?this.panTo(d):(this.moveTo(d),this.dragging&&(this.dragging=!1,this.events.triggerEvent("moveend")))}},panTo:function(a){if(this.panMethod&&this.getExtent().scale(this.panRatio).containsLonLat(a)){this.panTween||(this.panTween=new OpenLayers.Tween(this.panMethod));var b=this.getCachedCenter();if(!a.equals(b)){var b=this.getPixelFromLonLat(b),c=this.getPixelFromLonLat(a),d=0,e=0;this.panTween.start({x:0,y:0},{x:c.x-b.x,y:c.y-b.y},this.panDuration,{callbacks:{eachStep:OpenLayers.Function.bind(function(a){this.moveByPx(a.x-d,a.y-e);d=Math.round(a.x);e=Math.round(a.y)},this),done:OpenLayers.Function.bind(function(){this.moveTo(a);this.dragging=false;this.events.triggerEvent("moveend")},this)}})}}else this.setCenter(a)},setCenter:function(a,b,c,d){this.panTween&&this.panTween.stop();this.moveTo(a,b,{dragging:c,forceZoomChange:d})},moveByPx:function(a,b){var c=this.size.w/2,d=this.size.h/2,e=c+a,f=d+b,g=this.baseLayer.wrapDateLine,h=0,i=0;this.restrictedExtent&&(h=c,i=d,g=!1);a=g||e<=this.maxPx.x-h&&e>=this.minPx.x+h?Math.round(a):0;b=f<=this.maxPx.y-i&&f>=this.minPx.y+i?Math.round(b):0;if(a||b){this.dragging||(this.dragging=!0,this.events.triggerEvent("movestart"));this.center=null;a&&(this.layerContainerDiv.style.left=parseInt(this.layerContainerDiv.style.left)-a+"px",this.minPx.x-=a,this.maxPx.x-=a);b&&(this.layerContainerDiv.style.top=parseInt(this.layerContainerDiv.style.top)-b+"px",this.minPx.y-=b,this.maxPx.y-=b);d=0;for(e=this.layers.length;d<e;++d)if(c=this.layers[d],c.visibility&&(c===this.baseLayer||c.inRange))c.moveByPx(a,b),c.events.triggerEvent("move");this.events.triggerEvent("move")}},adjustZoom:function(a){var b=this.baseLayer.resolutions,c=this.getMaxExtent().getWidth()/this.size.w;if(this.getResolutionForZoom(a)>c)for(var d=a|0,e=b.length;d<e;++d)if(b[d]<=c){a=d;break}return a},moveTo:function(a,b,c){null!=a&&!(a instanceof OpenLayers.LonLat)&&(a=new OpenLayers.LonLat(a));c||(c={});null!=b&&(b=parseFloat(b),this.fractionalZoom||(b=Math.round(b)));if(this.baseLayer.wrapDateLine){var d=b,b=this.adjustZoom(b);b!==d&&(a=this.getCenter())}var d=c.dragging||this.dragging,e=c.forceZoomChange;!this.getCachedCenter()&&!this.isValidLonLat(a)&&(a=this.maxExtent.getCenterLonLat(),this.center=a.clone());if(null!=this.restrictedExtent){null==a&&(a=this.center);null==b&&(b=this.getZoom());var f=this.getResolutionForZoom(b),f=this.calculateBounds(a,f);if(!this.restrictedExtent.containsBounds(f)){var g=this.restrictedExtent.getCenterLonLat();f.getWidth()>this.restrictedExtent.getWidth()?a=new OpenLayers.LonLat(g.lon,a.lat):f.left<this.restrictedExtent.left?a=a.add(this.restrictedExtent.left-f.left,0):f.right>this.restrictedExtent.right&&(a=a.add(this.restrictedExtent.right-f.right,0));f.getHeight()>this.restrictedExtent.getHeight()?a=new OpenLayers.LonLat(a.lon,g.lat):f.bottom<this.restrictedExtent.bottom?a=a.add(0,this.restrictedExtent.bottom-f.bottom):f.top>this.restrictedExtent.top&&(a=a.add(0,this.restrictedExtent.top-f.top))}}e=e||this.isValidZoomLevel(b)&&b!=this.getZoom();f=this.isValidLonLat(a)&&!a.equals(this.center);if(e||f||d){d||this.events.triggerEvent("movestart");f&&(!e&&this.center&&this.centerLayerContainer(a),this.center=a.clone());a=e?this.getResolutionForZoom(b):this.getResolution();if(e||null==this.layerContainerOrigin){this.layerContainerOrigin=this.getCachedCenter();this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px";var f=this.getMaxExtent({restricted:!0}),h=f.getCenterLonLat(),g=this.center.lon-h.lon,h=h.lat-this.center.lat,i=Math.round(f.getWidth()/a),j=Math.round(f.getHeight()/a);this.minPx={x:(this.size.w-i)/2-g/a,y:(this.size.h-j)/2-h/a};this.maxPx={x:this.minPx.x+Math.round(f.getWidth()/a),y:this.minPx.y+Math.round(f.getHeight()/a)}}e&&(this.zoom=b,this.resolution=a);a=this.getExtent();this.baseLayer.visibility&&(this.baseLayer.moveTo(a,e,c.dragging),c.dragging||this.baseLayer.events.triggerEvent("moveend",{zoomChanged:e}));a=this.baseLayer.getExtent();for(b=this.layers.length-1;0<=b;--b)if(f=this.layers[b],f!==this.baseLayer&&!f.isBaseLayer&&(g=f.calculateInRange(),f.inRange!=g&&((f.inRange=g)||f.display(!1),this.events.triggerEvent("changelayer",{layer:f,property:"visibility"})),g&&f.visibility))f.moveTo(a,e,c.dragging),c.dragging||f.events.triggerEvent("moveend",{zoomChanged:e});this.events.triggerEvent("move");d||this.events.triggerEvent("moveend");if(e){b=0;for(c=this.popups.length;b<c;b++)this.popups[b].updatePosition();this.events.triggerEvent("zoomend")}}},centerLayerContainer:function(a){var b=this.getViewPortPxFromLonLat(this.layerContainerOrigin),c=this.getViewPortPxFromLonLat(a);if(null!=b&&null!=c){var d=parseInt(this.layerContainerDiv.style.left),a=parseInt(this.layerContainerDiv.style.top),e=Math.round(b.x-c.x),b=Math.round(b.y-c.y);this.layerContainerDiv.style.left=e+"px";this.layerContainerDiv.style.top=b+"px";d-=e;a-=b;this.minPx.x-=d;this.maxPx.x-=d;this.minPx.y-=a;this.maxPx.y-=a}},isValidZoomLevel:function(a){return null!=a&&0<=a&&a<this.getNumZoomLevels()},isValidLonLat:function(a){var b=!1;null!=a&&(b=this.getMaxExtent(),b=b.containsLonLat(a,{worldBounds:this.baseLayer.wrapDateLine&&b}));return b},getProjection:function(){var a=this.getProjectionObject();return a?a.getCode():null},getProjectionObject:function(){var a=null;null!=this.baseLayer&&(a=this.baseLayer.projection);return a},getMaxResolution:function(){var a=null;null!=this.baseLayer&&(a=this.baseLayer.maxResolution);return a},getMaxExtent:function(a){var b=null;a&&a.restricted&&this.restrictedExtent?b=this.restrictedExtent:null!=this.baseLayer&&(b=this.baseLayer.maxExtent);return b},getNumZoomLevels:function(){var a=null;null!=this.baseLayer&&(a=this.baseLayer.numZoomLevels);return a},getExtent:function(){var a=null;null!=this.baseLayer&&(a=this.baseLayer.getExtent());return a},getResolution:function(){var a=null;null!=this.baseLayer?a=this.baseLayer.getResolution():!0===this.allOverlays&&0<this.layers.length&&(a=this.layers[0].getResolution());return a},getUnits:function(){var a=null;null!=this.baseLayer&&(a=this.baseLayer.units);return a},getScale:function(){var a=null;null!=this.baseLayer&&(a=this.getResolution(),a=OpenLayers.Util.getScaleFromResolution(a,this.baseLayer.units));return a},getZoomForExtent:function(a,b){var c=null;null!=this.baseLayer&&(c=this.baseLayer.getZoomForExtent(a,b));return c},getResolutionForZoom:function(a){var b=null;this.baseLayer&&(b=this.baseLayer.getResolutionForZoom(a));return b},getZoomForResolution:function(a,b){var c=null;null!=this.baseLayer&&(c=this.baseLayer.getZoomForResolution(a,b));return c},zoomTo:function(a){this.isValidZoomLevel(a)&&this.setCenter(null,a)},zoomIn:function(){this.zoomTo(this.getZoom()+1)},zoomOut:function(){this.zoomTo(this.getZoom()-1)},zoomToExtent:function(a,b){a instanceof OpenLayers.Bounds||(a=new OpenLayers.Bounds(a));var c=a.getCenterLonLat();if(this.baseLayer.wrapDateLine){c=this.getMaxExtent();for(a=a.clone();a.right<a.left;)a.right+=c.getWidth();c=a.getCenterLonLat().wrapDateLine(c)}this.setCenter(c,this.getZoomForExtent(a,b))},zoomToMaxExtent:function(a){this.zoomToExtent(this.getMaxExtent({restricted:a?a.restricted:!0}))},zoomToScale:function(a,b){var c=OpenLayers.Util.getResolutionFromScale(a,this.baseLayer.units),d=this.size.w*c/2,c=this.size.h*c/2,e=this.getCachedCenter();this.zoomToExtent(new OpenLayers.Bounds(e.lon-d,e.lat-c,e.lon+d,e.lat+c),b)},getLonLatFromViewPortPx:function(a){var b=null;null!=this.baseLayer&&(b=this.baseLayer.getLonLatFromViewPortPx(a));return b},getViewPortPxFromLonLat:function(a){var b=null;null!=this.baseLayer&&(b=this.baseLayer.getViewPortPxFromLonLat(a));return b},getLonLatFromPixel:function(a){return this.getLonLatFromViewPortPx(a)},getPixelFromLonLat:function(a){a=this.getViewPortPxFromLonLat(a);a.x=Math.round(a.x);a.y=Math.round(a.y);return a},getGeodesicPixelSize:function(a){var b=a?this.getLonLatFromPixel(a):this.getCachedCenter()||new OpenLayers.LonLat(0,0),c=this.getResolution(),a=b.add(-c/2,0),d=b.add(c/2,0),e=b.add(0,-c/2),b=b.add(0,c/2),c=new OpenLayers.Projection("EPSG:4326"),f=this.getProjectionObject()||c;f.equals(c)||(a.transform(f,c),d.transform(f,c),e.transform(f,c),b.transform(f,c));return new OpenLayers.Size(OpenLayers.Util.distVincenty(a,d),OpenLayers.Util.distVincenty(e,b))},getViewPortPxFromLayerPx:function(a){var b=null;if(null!=a)var b=parseInt(this.layerContainerDiv.style.left),c=parseInt(this.layerContainerDiv.style.top),b=a.add(b,c);return b},getLayerPxFromViewPortPx:function(a){var b=null;if(null!=a){var b=-parseInt(this.layerContainerDiv.style.left),c=-parseInt(this.layerContainerDiv.style.top),b=a.add(b,c);if(isNaN(b.x)||isNaN(b.y))b=null}return b},getLonLatFromLayerPx:function(a){a=this.getViewPortPxFromLayerPx(a);return this.getLonLatFromViewPortPx(a)},getLayerPxFromLonLat:function(a){return this.getLayerPxFromViewPortPx(this.getPixelFromLonLat(a))},CLASS_NAME:"OpenLayers.Map"});OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;OpenLayers.Layer=OpenLayers.Class({id:null,name:null,div:null,opacity:1,alwaysInRange:null,RESOLUTION_PROPERTIES:"scales resolutions maxScale minScale maxResolution minResolution numZoomLevels maxZoomLevel".split(" "),events:null,map:null,isBaseLayer:!1,alpha:!1,displayInLayerSwitcher:!0,visibility:!0,attribution:null,inRange:!1,imageSize:null,options:null,eventListeners:null,gutter:0,projection:null,units:null,scales:null,resolutions:null,maxExtent:null,minExtent:null,maxResolution:null,minResolution:null,numZoomLevels:null,minScale:null,maxScale:null,displayOutsideMaxExtent:!1,wrapDateLine:!1,metadata:null,initialize:function(a,b){this.metadata={};this.addOptions(b);this.name=a;if(null==this.id&&(this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_"),this.div=OpenLayers.Util.createDiv(this.id),this.div.style.width="100%",this.div.style.height="100%",this.div.dir="ltr",this.events=new OpenLayers.Events(this,this.div),this.eventListeners instanceof Object))this.events.on(this.eventListeners)},destroy:function(a){null==a&&(a=!0);null!=this.map&&this.map.removeLayer(this,a);this.options=this.div=this.name=this.map=this.projection=null;this.events&&(this.eventListeners&&this.events.un(this.eventListeners),this.events.destroy());this.events=this.eventListeners=null},clone:function(a){null==a&&(a=new OpenLayers.Layer(this.name,this.getOptions()));OpenLayers.Util.applyDefaults(a,this);a.map=null;return a},getOptions:function(){var a={},b;for(b in this.options)a[b]=this[b];return a},setName:function(a){a!=this.name&&(this.name=a,null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"name"}))},addOptions:function(a,b){null==this.options&&(this.options={});if(a&&("string"==typeof a.projection&&(a.projection=new OpenLayers.Projection(a.projection)),a.projection&&OpenLayers.Util.applyDefaults(a,OpenLayers.Projection.defaults[a.projection.getCode()]),a.maxExtent&&!(a.maxExtent instanceof OpenLayers.Bounds)&&(a.maxExtent=new OpenLayers.Bounds(a.maxExtent)),a.minExtent&&!(a.minExtent instanceof OpenLayers.Bounds)))a.minExtent=new OpenLayers.Bounds(a.minExtent);OpenLayers.Util.extend(this.options,a);OpenLayers.Util.extend(this,a);this.projection&&this.projection.getUnits()&&(this.units=this.projection.getUnits());if(this.map){var c=this.map.getResolution(),d=this.RESOLUTION_PROPERTIES.concat(["projection","units","minExtent","maxExtent"]),e;for(e in a)if(a.hasOwnProperty(e)&&0<=OpenLayers.Util.indexOf(d,e)){this.initResolutions();b&&this.map.baseLayer===this&&(this.map.setCenter(this.map.getCenter(),this.map.getZoomForResolution(c),!1,!0),this.map.events.triggerEvent("changebaselayer",{layer:this}));break}}},onMapResize:function(){},redraw:function(){var a=!1;if(this.map){this.inRange=this.calculateInRange();var b=this.getExtent();b&&(this.inRange&&this.visibility)&&(this.moveTo(b,!0,!1),this.events.triggerEvent("moveend",{zoomChanged:!0}),a=!0)}return a},moveTo:function(){var a=this.visibility;this.isBaseLayer||(a=a&&this.inRange);this.display(a)},moveByPx:function(){},setMap:function(a){null==this.map&&(this.map=a,this.maxExtent=this.maxExtent||this.map.maxExtent,this.minExtent=this.minExtent||this.map.minExtent,this.projection=this.projection||this.map.projection,"string"==typeof this.projection&&(this.projection=new OpenLayers.Projection(this.projection)),this.units=this.projection.getUnits()||this.units||this.map.units,this.initResolutions(),this.isBaseLayer||(this.inRange=this.calculateInRange(),this.div.style.display=this.visibility&&this.inRange?"":"none"),this.setTileSize())},afterAdd:function(){},removeMap:function(){},getImageSize:function(){return this.imageSize||this.tileSize},setTileSize:function(a){this.tileSize=a=a?a:this.tileSize?this.tileSize:this.map.getTileSize();this.gutter&&(this.imageSize=new OpenLayers.Size(a.w+2*this.gutter,a.h+2*this.gutter))},getVisibility:function(){return this.visibility},setVisibility:function(a){a!=this.visibility&&(this.visibility=a,this.display(a),this.redraw(),null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"}),this.events.triggerEvent("visibilitychanged"))},display:function(a){a!=("none"!=this.div.style.display)&&(this.div.style.display=a&&this.calculateInRange()?"block":"none")},calculateInRange:function(){var a=!1;this.alwaysInRange?a=!0:this.map&&(a=this.map.getResolution(),a=a>=this.minResolution&&a<=this.maxResolution);return a},setIsBaseLayer:function(a){a!=this.isBaseLayer&&(this.isBaseLayer=a,null!=this.map&&this.map.events.triggerEvent("changebaselayer",{layer:this}))},initResolutions:function(){var a,b,c,d={},e=!0;a=0;for(b=this.RESOLUTION_PROPERTIES.length;a<b;a++)c=this.RESOLUTION_PROPERTIES[a],d[c]=this.options[c],e&&this.options[c]&&(e=!1);null==this.alwaysInRange&&(this.alwaysInRange=e);null==d.resolutions&&(d.resolutions=this.resolutionsFromScales(d.scales));null==d.resolutions&&(d.resolutions=this.calculateResolutions(d));if(null==d.resolutions){a=0;for(b=this.RESOLUTION_PROPERTIES.length;a<b;a++)c=this.RESOLUTION_PROPERTIES[a],d[c]=null!=this.options[c]?this.options[c]:this.map[c];null==d.resolutions&&(d.resolutions=this.resolutionsFromScales(d.scales));null==d.resolutions&&(d.resolutions=this.calculateResolutions(d))}var f;this.options.maxResolution&&"auto"!==this.options.maxResolution&&(f=this.options.maxResolution);this.options.minScale&&(f=OpenLayers.Util.getResolutionFromScale(this.options.minScale,this.units));var g;this.options.minResolution&&"auto"!==this.options.minResolution&&(g=this.options.minResolution);this.options.maxScale&&(g=OpenLayers.Util.getResolutionFromScale(this.options.maxScale,this.units));d.resolutions&&(d.resolutions.sort(function(a,b){return b-a}),f||(f=d.resolutions[0]),g||(g=d.resolutions[d.resolutions.length-1]));if(this.resolutions=d.resolutions){b=this.resolutions.length;this.scales=Array(b);for(a=0;a<b;a++)this.scales[a]=OpenLayers.Util.getScaleFromResolution(this.resolutions[a],this.units);this.numZoomLevels=b}if(this.minResolution=g)this.maxScale=OpenLayers.Util.getScaleFromResolution(g,this.units);if(this.maxResolution=f)this.minScale=OpenLayers.Util.getScaleFromResolution(f,this.units)},resolutionsFromScales:function(a){if(null!=a){var b,c,d;d=a.length;b=Array(d);for(c=0;c<d;c++)b[c]=OpenLayers.Util.getResolutionFromScale(a[c],this.units);return b}},calculateResolutions:function(a){var b,c,d=a.maxResolution;null!=a.minScale?d=OpenLayers.Util.getResolutionFromScale(a.minScale,this.units):"auto"==d&&null!=this.maxExtent&&(b=this.map.getSize(),c=this.maxExtent.getWidth()/b.w,b=this.maxExtent.getHeight()/b.h,d=Math.max(c,b));c=a.minResolution;null!=a.maxScale?c=OpenLayers.Util.getResolutionFromScale(a.maxScale,this.units):"auto"==a.minResolution&&null!=this.minExtent&&(b=this.map.getSize(),
c=this.minExtent.getWidth()/b.w,b=this.minExtent.getHeight()/b.h,c=Math.max(c,b));"number"!==typeof d&&("number"!==typeof c&&null!=this.maxExtent)&&(d=this.map.getTileSize(),d=Math.max(this.maxExtent.getWidth()/d.w,this.maxExtent.getHeight()/d.h));b=a.maxZoomLevel;a=a.numZoomLevels;"number"===typeof c&&"number"===typeof d&&void 0===a?a=Math.floor(Math.log(d/c)/Math.log(2))+1:void 0===a&&null!=b&&(a=b+1);if(!("number"!==typeof a||0>=a||"number"!==typeof d&&"number"!==typeof c)){b=Array(a);var e=2;"number"==typeof c&&"number"==typeof d&&(e=Math.pow(d/c,1/(a-1)));var f;if("number"===typeof d)for(f=0;f<a;f++)b[f]=d/Math.pow(e,f);else for(f=0;f<a;f++)b[a-1-f]=c*Math.pow(e,f);return b}},getResolution:function(){return this.getResolutionForZoom(this.map.getZoom())},getExtent:function(){return this.map.calculateBounds()},getZoomForExtent:function(a,b){var c=this.map.getSize();return this.getZoomForResolution(Math.max(a.getWidth()/c.w,a.getHeight()/c.h),b)},getDataExtent:function(){},getResolutionForZoom:function(a){a=Math.max(0,Math.min(a,this.resolutions.length-1));if(this.map.fractionalZoom)var b=Math.floor(a),c=Math.ceil(a),a=this.resolutions[b]-(a-b)*(this.resolutions[b]-this.resolutions[c]);else a=this.resolutions[Math.round(a)];return a},getZoomForResolution:function(a,b){var c,d;if(this.map.fractionalZoom){var e=0,f=this.resolutions[e],g=this.resolutions[this.resolutions.length-1],h;c=0;for(d=this.resolutions.length;c<d;++c)if(h=this.resolutions[c],h>=a&&(f=h,e=c),h<=a){g=h;break}c=f-g;c=0<c?e+(f-a)/c:e}else{f=Number.POSITIVE_INFINITY;c=0;for(d=this.resolutions.length;c<d;c++)if(b){e=Math.abs(this.resolutions[c]-a);if(e>f)break;f=e}else if(this.resolutions[c]<a)break;c=Math.max(0,c-1)}return c},getLonLatFromViewPortPx:function(a){var b=null,c=this.map;if(null!=a&&c.minPx){var b=c.getResolution(),d=c.getMaxExtent({restricted:!0}),b=new OpenLayers.LonLat((a.x-c.minPx.x)*b+d.left,(c.minPx.y-a.y)*b+d.top);this.wrapDateLine&&(b=b.wrapDateLine(this.maxExtent))}return b},getViewPortPxFromLonLat:function(a,b){var c=null;null!=a&&(b=b||this.map.getResolution(),c=this.map.calculateBounds(null,b),c=new OpenLayers.Pixel(1/b*(a.lon-c.left),1/b*(c.top-a.lat)));return c},setOpacity:function(a){if(a!=this.opacity){this.opacity=a;for(var b=this.div.childNodes,c=0,d=b.length;c<d;++c){var e=b[c].firstChild||b[c],f=b[c].lastChild;f&&"iframe"===f.nodeName.toLowerCase()&&(e=f.parentNode);OpenLayers.Util.modifyDOMElement(e,null,null,null,null,null,null,a)}null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"})}},getZIndex:function(){return this.div.style.zIndex},setZIndex:function(a){this.div.style.zIndex=a},adjustBounds:function(a){if(this.gutter)var b=this.gutter*this.map.getResolution(),a=new OpenLayers.Bounds(a.left-b,a.bottom-b,a.right+b,a.top+b);this.wrapDateLine&&(b={rightTolerance:this.getResolution(),leftTolerance:this.getResolution()},a=a.wrapDateLine(this.maxExtent,b));return a},CLASS_NAME:"OpenLayers.Layer"});OpenLayers.Layer.SphericalMercator={getExtent:function(){var a=null;return a=this.sphericalMercator?this.map.calculateBounds():OpenLayers.Layer.FixedZoomLevels.prototype.getExtent.apply(this)},getLonLatFromViewPortPx:function(a){return OpenLayers.Layer.prototype.getLonLatFromViewPortPx.apply(this,arguments)},getViewPortPxFromLonLat:function(a){return OpenLayers.Layer.prototype.getViewPortPxFromLonLat.apply(this,arguments)},initMercatorParameters:function(){this.RESOLUTIONS=[];for(var a=0;a<=this.MAX_ZOOM_LEVEL;++a)this.RESOLUTIONS[a]=156543.03390625/Math.pow(2,a);this.units="m";this.projection=this.projection||"EPSG:900913"},forwardMercator:function(){var a=new OpenLayers.Projection("EPSG:4326"),b=new OpenLayers.Projection("EPSG:900913");return function(c,d){var e=OpenLayers.Projection.transform({x:c,y:d},a,b);return new OpenLayers.LonLat(e.x,e.y)}}(),inverseMercator:function(){var a=new OpenLayers.Projection("EPSG:4326"),b=new OpenLayers.Projection("EPSG:900913");return function(c,d){var e=OpenLayers.Projection.transform({x:c,y:d},b,a);return new OpenLayers.LonLat(e.x,e.y)}}()};OpenLayers.Layer.EventPane=OpenLayers.Class(OpenLayers.Layer,{smoothDragPan:!0,isBaseLayer:!0,isFixed:!0,pane:null,mapObject:null,initialize:function(a,b){OpenLayers.Layer.prototype.initialize.apply(this,arguments);null==this.pane&&(this.pane=OpenLayers.Util.createDiv(this.div.id+"_EventPane"))},destroy:function(){this.pane=this.mapObject=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Layer.prototype.setMap.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1;this.pane.style.display=this.div.style.display;this.pane.style.width="100%";this.pane.style.height="100%";"msie"==OpenLayers.BROWSER_NAME&&(this.pane.style.background="url("+OpenLayers.Util.getImageLocation("blank.gif")+")");this.isFixed?this.map.viewPortDiv.appendChild(this.pane):this.map.layerContainerDiv.appendChild(this.pane);this.loadMapObject();null==this.mapObject&&this.loadWarningMessage()},removeMap:function(a){this.pane&&this.pane.parentNode&&this.pane.parentNode.removeChild(this.pane);OpenLayers.Layer.prototype.removeMap.apply(this,arguments)},loadWarningMessage:function(){this.div.style.backgroundColor="darkblue";var a=this.map.getSize(),b=Math.min(a.w,300),c=Math.min(a.h,200),b=new OpenLayers.Size(b,c),a=new OpenLayers.Pixel(a.w/2,a.h/2).add(-b.w/2,-b.h/2),a=OpenLayers.Util.createDiv(this.name+"_warning",a,b,null,null,null,"auto");a.style.padding="7px";a.style.backgroundColor="yellow";a.innerHTML=this.getWarningHTML();this.div.appendChild(a)},getWarningHTML:function(){return""},display:function(a){OpenLayers.Layer.prototype.display.apply(this,arguments);this.pane.style.display=this.div.style.display},setZIndex:function(a){OpenLayers.Layer.prototype.setZIndex.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1},moveByPx:function(a,b){OpenLayers.Layer.prototype.moveByPx.apply(this,arguments);this.dragPanMapObject?this.dragPanMapObject(a,-b):this.moveTo(this.map.getCachedCenter())},moveTo:function(a,b,c){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(null!=this.mapObject){var d=this.map.getCenter(),e=this.map.getZoom();if(null!=d){var f=this.getOLLonLatFromMapObjectLonLat(this.getMapObjectCenter()),g=this.getOLZoomFromMapObjectZoom(this.getMapObjectZoom());if(!d.equals(f)||e!=g)!b&&f&&this.dragPanMapObject&&this.smoothDragPan?(e=this.map.getViewPortPxFromLonLat(f),d=this.map.getViewPortPxFromLonLat(d),this.dragPanMapObject(d.x-e.x,e.y-d.y)):(d=this.getMapObjectLonLatFromOLLonLat(d),e=this.getMapObjectZoomFromOLZoom(e),this.setMapObjectCenter(d,e,c))}}},getLonLatFromViewPortPx:function(a){var b=null;null!=this.mapObject&&null!=this.getMapObjectCenter()&&(b=this.getOLLonLatFromMapObjectLonLat(this.getMapObjectLonLatFromMapObjectPixel(this.getMapObjectPixelFromOLPixel(a))));return b},getViewPortPxFromLonLat:function(a){var b=null;null!=this.mapObject&&null!=this.getMapObjectCenter()&&(b=this.getOLPixelFromMapObjectPixel(this.getMapObjectPixelFromMapObjectLonLat(this.getMapObjectLonLatFromOLLonLat(a))));return b},getOLLonLatFromMapObjectLonLat:function(a){var b=null;null!=a&&(b=this.getLongitudeFromMapObjectLonLat(a),a=this.getLatitudeFromMapObjectLonLat(a),b=new OpenLayers.LonLat(b,a));return b},getMapObjectLonLatFromOLLonLat:function(a){var b=null;null!=a&&(b=this.getMapObjectLonLatFromLonLat(a.lon,a.lat));return b},getOLPixelFromMapObjectPixel:function(a){var b=null;null!=a&&(b=this.getXFromMapObjectPixel(a),a=this.getYFromMapObjectPixel(a),b=new OpenLayers.Pixel(b,a));return b},getMapObjectPixelFromOLPixel:function(a){var b=null;null!=a&&(b=this.getMapObjectPixelFromXY(a.x,a.y));return b},CLASS_NAME:"OpenLayers.Layer.EventPane"});OpenLayers.Layer.FixedZoomLevels=OpenLayers.Class({initialize:function(){},initResolutions:function(){for(var a=["minZoomLevel","maxZoomLevel","numZoomLevels"],b=0,c=a.length;b<c;b++){var d=a[b];this[d]=null!=this.options[d]?this.options[d]:this.map[d]}if(null==this.minZoomLevel||this.minZoomLevel<this.MIN_ZOOM_LEVEL)this.minZoomLevel=this.MIN_ZOOM_LEVEL;a=this.MAX_ZOOM_LEVEL-this.minZoomLevel+1;b=null==this.options.numZoomLevels&&null!=this.options.maxZoomLevel||null==this.numZoomLevels&&null!=this.maxZoomLevel?this.maxZoomLevel-this.minZoomLevel+1:this.numZoomLevels;this.numZoomLevels=null!=b?Math.min(b,a):a;this.maxZoomLevel=this.minZoomLevel+this.numZoomLevels-1;if(null!=this.RESOLUTIONS){a=0;this.resolutions=[];for(b=this.minZoomLevel;b<=this.maxZoomLevel;b++)this.resolutions[a++]=this.RESOLUTIONS[b];this.maxResolution=this.resolutions[0];this.minResolution=this.resolutions[this.resolutions.length-1]}},getResolution:function(){if(null!=this.resolutions)return OpenLayers.Layer.prototype.getResolution.apply(this,arguments);var a=null,b=this.map.getSize(),c=this.getExtent();null!=b&&null!=c&&(a=Math.max(c.getWidth()/b.w,c.getHeight()/b.h));return a},getExtent:function(){var a=this.map.getSize(),b=this.getLonLatFromViewPortPx({x:0,y:0}),a=this.getLonLatFromViewPortPx({x:a.w,y:a.h});return null!=b&&null!=a?new OpenLayers.Bounds(b.lon,a.lat,a.lon,b.lat):null},getZoomForResolution:function(a){return null!=this.resolutions?OpenLayers.Layer.prototype.getZoomForResolution.apply(this,arguments):this.getZoomForExtent(OpenLayers.Layer.prototype.getExtent.apply(this,[]))},getOLZoomFromMapObjectZoom:function(a){var b=null;null!=a&&(b=a-this.minZoomLevel,this.map.baseLayer!==this&&(b=this.map.baseLayer.getZoomForResolution(this.getResolutionForZoom(b))));return b},getMapObjectZoomFromOLZoom:function(a){var b=null;null!=a&&(b=a+this.minZoomLevel,this.map.baseLayer!==this&&(b=this.getZoomForResolution(this.map.baseLayer.getResolutionForZoom(b))));return b},CLASS_NAME:"OpenLayers.Layer.FixedZoomLevels"});OpenLayers.Layer.Google=OpenLayers.Class(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:0,MAX_ZOOM_LEVEL:21,RESOLUTIONS:[1.40625,.703125,.3515625,.17578125,.087890625,.0439453125,.02197265625,.010986328125,.0054931640625,.00274658203125,.001373291015625,.0006866455078125,.00034332275390625,.000171661376953125,858306884765625e-19,4291534423828125e-20,2145767211914062e-20,1072883605957031e-20,536441802978515e-20,268220901489257e-20,1341104507446289e-21,6.705522537231445e-7],type:null,wrapDateLine:!0,sphericalMercator:!1,version:null,initialize:function(a,b){b=b||{};b.version||(b.version="function"===typeof GMap2?"2":"3");var c=OpenLayers.Layer.Google["v"+b.version.replace(/\./g,"_")];if(c)OpenLayers.Util.applyDefaults(b,c);else throw"Unsupported Google Maps API version: "+b.version;OpenLayers.Util.applyDefaults(b,c.DEFAULTS);b.maxExtent&&(b.maxExtent=b.maxExtent.clone());OpenLayers.Layer.EventPane.prototype.initialize.apply(this,[a,b]);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,[a,b]);this.sphericalMercator&&(OpenLayers.Util.extend(this,OpenLayers.Layer.SphericalMercator),this.initMercatorParameters())},clone:function(){return new OpenLayers.Layer.Google(this.name,this.getOptions())},setVisibility:function(a){var b=null==this.opacity?1:this.opacity;OpenLayers.Layer.EventPane.prototype.setVisibility.apply(this,arguments);this.setOpacity(b)},display:function(a){this._dragging||this.setGMapVisibility(a);OpenLayers.Layer.EventPane.prototype.display.apply(this,arguments)},moveTo:function(a,b,c){this._dragging=c;OpenLayers.Layer.EventPane.prototype.moveTo.apply(this,arguments);delete this._dragging},setOpacity:function(a){a!==this.opacity&&(null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"}),this.opacity=a);if(this.getVisibility()){var b=this.getMapContainer();OpenLayers.Util.modifyDOMElement(b,null,null,null,null,null,null,a)}},destroy:function(){if(this.map){this.setGMapVisibility(!1);var a=OpenLayers.Layer.Google.cache[this.map.id];a&&1>=a.count&&this.removeGMapElements()}OpenLayers.Layer.EventPane.prototype.destroy.apply(this,arguments)},removeGMapElements:function(){var a=OpenLayers.Layer.Google.cache[this.map.id];if(a){var b=this.mapObject&&this.getMapContainer();b&&b.parentNode&&b.parentNode.removeChild(b);(b=a.termsOfUse)&&b.parentNode&&b.parentNode.removeChild(b);(a=a.poweredBy)&&a.parentNode&&a.parentNode.removeChild(a)}},removeMap:function(a){this.visibility&&this.mapObject&&this.setGMapVisibility(!1);var b=OpenLayers.Layer.Google.cache[a.id];b&&(1>=b.count?(this.removeGMapElements(),delete OpenLayers.Layer.Google.cache[a.id]):--b.count);delete this.termsOfUse;delete this.poweredBy;delete this.mapObject;delete this.dragObject;OpenLayers.Layer.EventPane.prototype.removeMap.apply(this,arguments)},getOLBoundsFromMapObjectBounds:function(a){var b=null;null!=a&&(b=a.getSouthWest(),a=a.getNorthEast(),this.sphericalMercator?(b=this.forwardMercator(b.lng(),b.lat()),a=this.forwardMercator(a.lng(),a.lat())):(b=new OpenLayers.LonLat(b.lng(),b.lat()),a=new OpenLayers.LonLat(a.lng(),a.lat())),b=new OpenLayers.Bounds(b.lon,b.lat,a.lon,a.lat));return b},getWarningHTML:function(){return OpenLayers.i18n("googleWarning")},getMapObjectCenter:function(){return this.mapObject.getCenter()},getMapObjectZoom:function(){return this.mapObject.getZoom()},getLongitudeFromMapObjectLonLat:function(a){return this.sphericalMercator?this.forwardMercator(a.lng(),a.lat()).lon:a.lng()},getLatitudeFromMapObjectLonLat:function(a){return this.sphericalMercator?this.forwardMercator(a.lng(),a.lat()).lat:a.lat()},getXFromMapObjectPixel:function(a){return a.x},getYFromMapObjectPixel:function(a){return a.y},CLASS_NAME:"OpenLayers.Layer.Google"});OpenLayers.Layer.Google.cache={};OpenLayers.Layer.Google.v2={termsOfUse:null,poweredBy:null,dragObject:null,loadMapObject:function(){this.type||(this.type=G_NORMAL_MAP);var a,b,c,d=OpenLayers.Layer.Google.cache[this.map.id];if(d)a=d.mapObject,b=d.termsOfUse,c=d.poweredBy,++d.count;else{var d=this.map.viewPortDiv,e=document.createElement("div");e.id=this.map.id+"_GMap2Container";e.style.position="absolute";e.style.width="100%";e.style.height="100%";d.appendChild(e);try{a=new GMap2(e),b=e.lastChild,d.appendChild(b),b.style.zIndex="1100",b.style.right="",b.style.bottom="",b.className="olLayerGoogleCopyright",c=e.lastChild,d.appendChild(c),c.style.zIndex="1100",c.style.right="",c.style.bottom="",c.className="olLayerGooglePoweredBy gmnoprint"}catch(f){throw f}OpenLayers.Layer.Google.cache[this.map.id]={mapObject:a,termsOfUse:b,poweredBy:c,count:1}}this.mapObject=a;this.termsOfUse=b;this.poweredBy=c;-1===OpenLayers.Util.indexOf(this.mapObject.getMapTypes(),this.type)&&this.mapObject.addMapType(this.type);"function"==typeof a.getDragObject?this.dragObject=a.getDragObject():this.dragPanMapObject=null;!1===this.isBaseLayer&&this.setGMapVisibility("none"!==this.div.style.display)},onMapResize:function(){if(this.visibility&&this.mapObject.isLoaded())this.mapObject.checkResize();else{if(!this._resized)var a=this,b=GEvent.addListener(this.mapObject,"load",function(){GEvent.removeListener(b);delete a._resized;a.mapObject.checkResize();a.moveTo(a.map.getCenter(),a.map.getZoom())});this._resized=!0}},setGMapVisibility:function(a){var b=OpenLayers.Layer.Google.cache[this.map.id];if(b){var c=this.mapObject.getContainer();!0===a?(this.mapObject.setMapType(this.type),c.style.display="",this.termsOfUse.style.left="",this.termsOfUse.style.display="",this.poweredBy.style.display="",b.displayed=this.id):(b.displayed===this.id&&delete b.displayed,b.displayed||(c.style.display="none",this.termsOfUse.style.display="none",this.termsOfUse.style.left="-9999px",this.poweredBy.style.display="none"))}},getMapContainer:function(){return this.mapObject.getContainer()},getMapObjectBoundsFromOLBounds:function(a){var b=null;null!=a&&(b=this.sphericalMercator?this.inverseMercator(a.bottom,a.left):new OpenLayers.LonLat(a.bottom,a.left),a=this.sphericalMercator?this.inverseMercator(a.top,a.right):new OpenLayers.LonLat(a.top,a.right),b=new GLatLngBounds(new GLatLng(b.lat,b.lon),new GLatLng(a.lat,a.lon)));return b},setMapObjectCenter:function(a,b){this.mapObject.setCenter(a,b)},dragPanMapObject:function(a,b){this.dragObject.moveBy(new GSize(-a,b))},getMapObjectLonLatFromMapObjectPixel:function(a){return this.mapObject.fromContainerPixelToLatLng(a)},getMapObjectPixelFromMapObjectLonLat:function(a){return this.mapObject.fromLatLngToContainerPixel(a)},getMapObjectZoomFromMapObjectBounds:function(a){return this.mapObject.getBoundsZoomLevel(a)},getMapObjectLonLatFromLonLat:function(a,b){var c;this.sphericalMercator?(c=this.inverseMercator(a,b),c=new GLatLng(c.lat,c.lon)):c=new GLatLng(b,a);return c},getMapObjectPixelFromXY:function(a,b){return new GPoint(a,b)}};OpenLayers.Format.XML=OpenLayers.Class(OpenLayers.Format,{namespaces:null,namespaceAlias:null,defaultPrefix:null,readers:{},writers:{},xmldom:null,initialize:function(a){window.ActiveXObject&&(this.xmldom=new ActiveXObject("Microsoft.XMLDOM"));OpenLayers.Format.prototype.initialize.apply(this,[a]);this.namespaces=OpenLayers.Util.extend({},this.namespaces);this.namespaceAlias={};for(var b in this.namespaces)this.namespaceAlias[this.namespaces[b]]=b},destroy:function(){this.xmldom=null;OpenLayers.Format.prototype.destroy.apply(this,arguments)},setNamespace:function(a,b){this.namespaces[a]=b;this.namespaceAlias[b]=a},read:function(a){var b=a.indexOf("<");0<b&&(a=a.substring(b));b=OpenLayers.Util.Try(OpenLayers.Function.bind(function(){var b;b=window.ActiveXObject&&!this.xmldom?new ActiveXObject("Microsoft.XMLDOM"):this.xmldom;b.loadXML(a);return b},this),function(){return(new DOMParser).parseFromString(a,"text/xml")},function(){var b=new XMLHttpRequest;b.open("GET","data:text/xml;charset=utf-8,"+encodeURIComponent(a),!1);b.overrideMimeType&&b.overrideMimeType("text/xml");b.send(null);return b.responseXML});this.keepData&&(this.data=b);return b},write:function(a){if(this.xmldom)a=a.xml;else{var b=new XMLSerializer;if(1==a.nodeType){var c=document.implementation.createDocument("","",null);c.importNode&&(a=c.importNode(a,!0));c.appendChild(a);a=b.serializeToString(c)}else a=b.serializeToString(a)}return a},createElementNS:function(a,b){return this.xmldom?"string"==typeof a?this.xmldom.createNode(1,b,a):this.xmldom.createNode(1,b,""):document.createElementNS(a,b)},createTextNode:function(a){"string"!==typeof a&&(a=""+a);return this.xmldom?this.xmldom.createTextNode(a):document.createTextNode(a)},getElementsByTagNameNS:function(a,b,c){var d=[];if(a.getElementsByTagNameNS)d=a.getElementsByTagNameNS(b,c);else for(var a=a.getElementsByTagName("*"),e,f,g=0,h=a.length;g<h;++g)if(e=a[g],f=e.prefix?e.prefix+":"+c:c,"*"==c||f==e.nodeName)("*"==b||b==e.namespaceURI)&&d.push(e);return d},getAttributeNodeNS:function(a,b,c){var d=null;if(a.getAttributeNodeNS)d=a.getAttributeNodeNS(b,c);else for(var a=a.attributes,e,f,g=0,h=a.length;g<h;++g)if(e=a[g],e.namespaceURI==b&&(f=e.prefix?e.prefix+":"+c:c,f==e.nodeName)){d=e;break}return d},getAttributeNS:function(a,b,c){var d="";if(a.getAttributeNS)d=a.getAttributeNS(b,c)||"";else if(a=this.getAttributeNodeNS(a,b,c))d=a.nodeValue;return d},getChildValue:function(a,b){var c=b||"";if(a)for(var d=a.firstChild;d;d=d.nextSibling)switch(d.nodeType){case 3:case 4:c+=d.nodeValue}return c},isSimpleContent:function(a){for(var b=!0,a=a.firstChild;a;a=a.nextSibling)if(1===a.nodeType){b=!1;break}return b},contentType:function(a){for(var b=!1,c=!1,d=OpenLayers.Format.XML.CONTENT_TYPE.EMPTY,a=a.firstChild;a;a=a.nextSibling){switch(a.nodeType){case 1:c=!0;break;case 8:break;default:b=!0}if(c&&b)break}if(c&&b)d=OpenLayers.Format.XML.CONTENT_TYPE.MIXED;else{if(c)return OpenLayers.Format.XML.CONTENT_TYPE.COMPLEX;if(b)return OpenLayers.Format.XML.CONTENT_TYPE.SIMPLE}return d},hasAttributeNS:function(a,b,c){var d=!1;return d=a.hasAttributeNS?a.hasAttributeNS(b,c):!!this.getAttributeNodeNS(a,b,c)},setAttributeNS:function(a,b,c,d){if(a.setAttributeNS)a.setAttributeNS(b,c,d);else if(this.xmldom)b?(b=a.ownerDocument.createNode(2,c,b),b.nodeValue=d,a.setAttributeNode(b)):a.setAttribute(c,d);else throw"setAttributeNS not implemented"},createElementNSPlus:function(a,b){var b=b||{},c=b.uri||this.namespaces[b.prefix];c||(c=a.indexOf(":"),c=this.namespaces[a.substring(0,c)]);c||(c=this.namespaces[this.defaultPrefix]);c=this.createElementNS(c,a);b.attributes&&this.setAttributes(c,b.attributes);var d=b.value;null!=d&&c.appendChild(this.createTextNode(d));return c},setAttributes:function(a,b){var c,d,e;for(e in b)null!=b[e]&&b[e].toString&&(c=b[e].toString(),d=this.namespaces[e.substring(0,e.indexOf(":"))]||null,this.setAttributeNS(a,d,e,c))},readNode:function(a,b){b||(b={});var c=this.readers[a.namespaceURI?this.namespaceAlias[a.namespaceURI]:this.defaultPrefix];if(c){var d=a.localName||a.nodeName.split(":").pop();(c=c[d]||c["*"])&&c.apply(this,[a,b])}return b},readChildNodes:function(a,b){b||(b={});for(var c=a.childNodes,d,e=0,f=c.length;e<f;++e)d=c[e],1==d.nodeType&&this.readNode(d,b);return b},writeNode:function(a,b,c){var d,e=a.indexOf(":");0<e?(d=a.substring(0,e),a=a.substring(e+1)):d=c?this.namespaceAlias[c.namespaceURI]:this.defaultPrefix;b=this.writers[d][a].apply(this,[b]);c&&c.appendChild(b);return b},getChildEl:function(a,b,c){return a&&this.getThisOrNextEl(a.firstChild,b,c)},getNextEl:function(a,b,c){return a&&this.getThisOrNextEl(a.nextSibling,b,c)},getThisOrNextEl:function(a,b,c){a:for(;a;a=a.nextSibling)switch(a.nodeType){case 1:if((!b||b===(a.localName||a.nodeName.split(":").pop()))&&(!c||c===a.namespaceURI))break a;a=null;break a;case 3:if(/^\s*$/.test(a.nodeValue))break;case 4:case 6:case 12:case 10:case 11:a=null;break a}return a||null},lookupNamespaceURI:function(a,b){var c=null;if(a)if(a.lookupNamespaceURI)c=a.lookupNamespaceURI(b);else a:switch(a.nodeType){case 1:if(null!==a.namespaceURI&&a.prefix===b){c=a.namespaceURI;break a}if(c=a.attributes.length)for(var d,e=0;e<c;++e)if(d=a.attributes[e],"xmlns"===d.prefix&&d.name==="xmlns:"+b){c=d.value||null;break a}else if("xmlns"===d.name&&null===b){c=d.value||null;break a}c=this.lookupNamespaceURI(a.parentNode,b);break a;case 2:c=this.lookupNamespaceURI(a.ownerElement,b);break a;case 9:c=this.lookupNamespaceURI(a.documentElement,b);break a;case 6:case 12:case 10:case 11:break a;default:c=this.lookupNamespaceURI(a.parentNode,b)}return c},getXMLDoc:function(){!OpenLayers.Format.XML.document&&!this.xmldom&&(document.implementation&&document.implementation.createDocument?OpenLayers.Format.XML.document=document.implementation.createDocument("","",null):!this.xmldom&&window.ActiveXObject&&(this.xmldom=new ActiveXObject("Microsoft.XMLDOM")));return OpenLayers.Format.XML.document||this.xmldom},CLASS_NAME:"OpenLayers.Format.XML"});OpenLayers.Format.XML.CONTENT_TYPE={EMPTY:0,SIMPLE:1,COMPLEX:2,MIXED:3};OpenLayers.Format.XML.lookupNamespaceURI=OpenLayers.Function.bind(OpenLayers.Format.XML.prototype.lookupNamespaceURI,OpenLayers.Format.XML.prototype);OpenLayers.Format.XML.document=null;OpenLayers.Format.WFST=function(a){var a=OpenLayers.Util.applyDefaults(a,OpenLayers.Format.WFST.DEFAULTS),b=OpenLayers.Format.WFST["v"+a.version.replace(/\./g,"_")];if(!b)throw"Unsupported WFST version: "+a.version;return new b(a)};OpenLayers.Format.WFST.DEFAULTS={version:"1.0.0"};OpenLayers.Format.WFST.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",wfs:"http://www.opengis.net/wfs",gml:"http://www.opengis.net/gml",ogc:"http://www.opengis.net/ogc",ows:"http://www.opengis.net/ows"},defaultPrefix:"wfs",version:null,schemaLocations:null,srsName:null,extractAttributes:!0,xy:!0,stateName:null,initialize:function(a){this.stateName={};this.stateName[OpenLayers.State.INSERT]="wfs:Insert";this.stateName[OpenLayers.State.UPDATE]="wfs:Update";this.stateName[OpenLayers.State.DELETE]="wfs:Delete";OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},getSrsName:function(a,b){var c=b&&b.srsName;c||(c=a&&a.layer?a.layer.projection.getCode():this.srsName);return c},read:function(a,b){b=b||{};OpenLayers.Util.applyDefaults(b,{output:"features"});"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a&&9==a.nodeType&&(a=a.documentElement);var c={};a&&this.readNode(a,c,!0);c.features&&"features"===b.output&&(c=c.features);return c},readers:{wfs:{FeatureCollection:function(a,b){b.features=[];this.readChildNodes(a,b)}}},write:function(a,b){var c=this.writeNode("wfs:Transaction",{features:a,options:b}),d=this.schemaLocationAttr();d&&this.setAttributeNS(c,this.namespaces.xsi,"xsi:schemaLocation",d);return OpenLayers.Format.XML.prototype.write.apply(this,[c])},writers:{wfs:{GetFeature:function(a){var b=this.createElementNSPlus("wfs:GetFeature",{attributes:{service:"WFS",version:this.version,handle:a&&a.handle,outputFormat:a&&a.outputFormat,maxFeatures:a&&a.maxFeatures,"xsi:schemaLocation":this.schemaLocationAttr(a)}});if("string"==typeof this.featureType)this.writeNode("Query",a,b);else for(var c=0,d=this.featureType.length;c<d;c++)a.featureType=this.featureType[c],this.writeNode("Query",a,b);return b},Transaction:function(a){var a=a||{},b=a.options||{},c=this.createElementNSPlus("wfs:Transaction",{attributes:{service:"WFS",version:this.version,handle:b.handle}}),d,e=a.features;if(e){!0===b.multi&&OpenLayers.Util.extend(this.geometryTypes,{"OpenLayers.Geometry.Point":"MultiPoint","OpenLayers.Geometry.LineString":!0===this.multiCurve?"MultiCurve":"MultiLineString","OpenLayers.Geometry.Polygon":!0===this.multiSurface?"MultiSurface":"MultiPolygon"});var f,g,a=0;for(d=e.length;a<d;++a)g=e[a],(f=this.stateName[g.state])&&this.writeNode(f,{feature:g,options:b},c);!0===b.multi&&this.setGeometryTypes()}if(b.nativeElements){a=0;for(d=b.nativeElements.length;a<d;++a)this.writeNode("wfs:Native",b.nativeElements[a],c)}return c},Native:function(a){return this.createElementNSPlus("wfs:Native",{attributes:{vendorId:a.vendorId,safeToIgnore:a.safeToIgnore},value:a.value})},Insert:function(a){var b=a.feature,a=a.options,a=this.createElementNSPlus("wfs:Insert",{attributes:{handle:a&&a.handle}});this.srsName=this.getSrsName(b);this.writeNode("feature:_typeName",b,a);return a},Update:function(a){var b=a.feature,a=a.options,a=this.createElementNSPlus("wfs:Update",{attributes:{handle:a&&a.handle,typeName:(this.featureNS?this.featurePrefix+":":"")+this.featureType}});this.featureNS&&a.setAttribute("xmlns:"+this.featurePrefix,this.featureNS);var c=b.modified;if(null!==this.geometryName&&(!c||void 0!==c.geometry))this.srsName=this.getSrsName(b),this.writeNode("Property",{name:this.geometryName,value:b.geometry},a);for(var d in b.attributes)void 0!==b.attributes[d]&&(!c||!c.attributes||c.attributes&&void 0!==c.attributes[d])&&this.writeNode("Property",{name:d,value:b.attributes[d]},a);this.writeNode("ogc:Filter",new OpenLayers.Filter.FeatureId({fids:[b.fid]}),a);return a},Property:function(a){var b=this.createElementNSPlus("wfs:Property");this.writeNode("Name",a.name,b);null!==a.value&&this.writeNode("Value",a.value,b);return b},Name:function(a){return this.createElementNSPlus("wfs:Name",{value:a})},Value:function(a){var b;a instanceof OpenLayers.Geometry?(b=this.createElementNSPlus("wfs:Value"),a=this.writeNode("feature:_geometry",a).firstChild,b.appendChild(a)):b=this.createElementNSPlus("wfs:Value",{value:a});return b},Delete:function(a){var b=a.feature,a=a.options,a=this.createElementNSPlus("wfs:Delete",{attributes:{handle:a&&a.handle,typeName:(this.featureNS?this.featurePrefix+":":"")+this.featureType}});this.featureNS&&a.setAttribute("xmlns:"+this.featurePrefix,this.featureNS);this.writeNode("ogc:Filter",new OpenLayers.Filter.FeatureId({fids:[b.fid]}),a);return a}}},schemaLocationAttr:function(a){var a=OpenLayers.Util.extend({featurePrefix:this.featurePrefix,schema:this.schema},a),b=OpenLayers.Util.extend({},this.schemaLocations);a.schema&&(b[a.featurePrefix]=a.schema);var a=[],c,d;for(d in b)(c=this.namespaces[d])&&a.push(c+" "+b[d]);return a.join(" ")||void 0},setFilterProperty:function(a){if(a.filters)for(var b=0,c=a.filters.length;b<c;++b)OpenLayers.Format.WFST.v1.prototype.setFilterProperty.call(this,a.filters[b]);else a instanceof OpenLayers.Filter.Spatial&&!a.property&&(a.property=this.geometryName)},CLASS_NAME:"OpenLayers.Format.WFST.v1"});OpenLayers.Format.OGCExceptionReport=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ogc:"http://www.opengis.net/ogc"},regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},defaultPrefix:"ogc",read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));var b={exceptionReport:null};a.documentElement&&(this.readChildNodes(a,b),null===b.exceptionReport&&(b=(new OpenLayers.Format.OWSCommon).read(a)));return b},readers:{ogc:{ServiceExceptionReport:function(a,b){b.exceptionReport={exceptions:[]};this.readChildNodes(a,b.exceptionReport)},ServiceException:function(a,b){var c={code:a.getAttribute("code"),locator:a.getAttribute("locator"),text:this.getChildValue(a)};b.exceptions.push(c)}}},CLASS_NAME:"OpenLayers.Format.OGCExceptionReport"});OpenLayers.Format.XML.VersionedOGC=OpenLayers.Class(OpenLayers.Format.XML,{defaultVersion:null,version:null,profile:null,errorProperty:null,name:null,stringifyOutput:!1,parser:null,initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a]);a=this.CLASS_NAME;this.name=a.substring(a.lastIndexOf(".")+1)},getVersion:function(a,b){var c;a?(c=this.version,c||(c=a.getAttribute("version"),c||(c=this.defaultVersion))):c=b&&b.version||this.version||this.defaultVersion;return c},getParser:function(a){var a=a||this.defaultVersion,b=this.profile?"_"+this.profile:"";if(!this.parser||this.parser.VERSION!=a){var c=OpenLayers.Format[this.name]["v"+a.replace(/\./g,"_")+b];if(!c)throw"Can't find a "+this.name+" parser for version "+a+b;this.parser=new c(this.options)}return this.parser},write:function(a,b){this.parser=this.getParser(this.getVersion(null,b));var c=this.parser.write(a,b);return!1===this.stringifyOutput?c:OpenLayers.Format.XML.prototype.write.apply(this,[c])},read:function(a,b){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));var c=this.getVersion(a.documentElement);this.parser=this.getParser(c);var d=this.parser.read(a,b);if(null!==this.errorProperty&&void 0===d[this.errorProperty]){var e=new OpenLayers.Format.OGCExceptionReport;d.error=e.read(a)}d.version=c;return d},CLASS_NAME:"OpenLayers.Format.XML.VersionedOGC"});OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:null,popup:null,initialize:function(a,b,c){this.layer=a;this.lonlat=b;this.data=null!=c?c:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){null!=this.layer&&null!=this.layer.map&&null!=this.popup&&this.layer.map.removePopup(this.popup);null!=this.layer&&null!=this.marker&&this.layer.removeMarker(this.marker);this.data=this.lonlat=this.id=this.layer=null;null!=this.marker&&(this.destroyMarker(this.marker),this.marker=null);null!=this.popup&&(this.destroyPopup(this.popup),this.popup=null)},onScreen:function(){var a=!1;null!=this.layer&&null!=this.layer.map&&(a=this.layer.map.getExtent().containsLonLat(this.lonlat));return a},createMarker:function(){null!=this.lonlat&&(this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon));return this.marker},destroyMarker:function(){this.marker.destroy()},createPopup:function(a){null!=this.lonlat&&(this.popup||(this.popup=new(this.popupClass?this.popupClass:OpenLayers.Popup.Anchored)(this.id+"_popup",this.lonlat,this.data.popupSize,this.data.popupContentHTML,this.marker?this.marker.icon:null,a)),null!=this.data.overflow&&(this.popup.contentDiv.style.overflow=this.data.overflow),this.popup.feature=this);return this.popup},destroyPopup:function(){this.popup&&(this.popup.feature=null,this.popup.destroy(),this.popup=null)},CLASS_NAME:"OpenLayers.Feature"});OpenLayers.State={UNKNOWN:"Unknown",INSERT:"Insert",UPDATE:"Update",DELETE:"Delete"};OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,
attributes:null,bounds:null,state:null,style:null,url:null,renderIntent:"default",modified:null,initialize:function(a,b,c){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,b]);this.lonlat=null;this.geometry=a?a:null;this.state=null;this.attributes={};b&&(this.attributes=OpenLayers.Util.extend(this.attributes,b));this.style=c?c:null},destroy:function(){this.layer&&(this.layer.removeFeatures(this),this.layer=null);this.modified=this.geometry=null;OpenLayers.Feature.prototype.destroy.apply(this,arguments)},clone:function(){return new OpenLayers.Feature.Vector(this.geometry?this.geometry.clone():null,this.attributes,this.style)},onScreen:function(a){var b=!1;this.layer&&this.layer.map&&(b=this.layer.map.getExtent(),a?(a=this.geometry.getBounds(),b=b.intersectsBounds(a)):b=b.toGeometry().intersects(this.geometry));return b},getVisibility:function(){return!(this.style&&"none"==this.style.display||!this.layer||this.layer&&this.layer.styleMap&&"none"==this.layer.styleMap.createSymbolizer(this,this.renderIntent).display||this.layer&&!this.layer.getVisibility())},createMarker:function(){return null},destroyMarker:function(){},createPopup:function(){return null},atPoint:function(a,b,c){var d=!1;this.geometry&&(d=this.geometry.atPoint(a,b,c));return d},destroyPopup:function(){},move:function(a){if(this.layer&&this.geometry.move){var a="OpenLayers.LonLat"==a.CLASS_NAME?this.layer.getViewPortPxFromLonLat(a):a,b=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat()),c=this.layer.map.getResolution();this.geometry.move(c*(a.x-b.x),c*(b.y-a.y));this.layer.drawFeature(this);return b}},toState:function(a){if(a==OpenLayers.State.UPDATE)switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.DELETE:this.state=a}else if(a==OpenLayers.State.INSERT)switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=a}else if(a==OpenLayers.State.DELETE)switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.UPDATE:this.state=a}else a==OpenLayers.State.UNKNOWN&&(this.state=a)},CLASS_NAME:"OpenLayers.Feature.Vector"});OpenLayers.Feature.Vector.style={"default":{fillColor:"#ee9900",fillOpacity:.4,hoverFillColor:"white",hoverFillOpacity:.8,strokeColor:"#ee9900",strokeOpacity:1,strokeWidth:1,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit",fontColor:"#000000",labelAlign:"cm",labelOutlineColor:"white",labelOutlineWidth:3},select:{fillColor:"blue",fillOpacity:.4,hoverFillColor:"white",hoverFillOpacity:.8,strokeColor:"blue",strokeOpacity:1,strokeWidth:2,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer",fontColor:"#000000",labelAlign:"cm",labelOutlineColor:"white",labelOutlineWidth:3},temporary:{fillColor:"#66cccc",fillOpacity:.2,hoverFillColor:"white",hoverFillOpacity:.8,strokeColor:"#66cccc",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit",fontColor:"#000000",labelAlign:"cm",labelOutlineColor:"white",labelOutlineWidth:3},"delete":{display:"none"}};OpenLayers.Style=OpenLayers.Class({id:null,name:null,title:null,description:null,layerName:null,isDefault:!1,rules:null,context:null,defaultStyle:null,defaultsPerSymbolizer:!1,propertyStyles:null,initialize:function(a,b){OpenLayers.Util.extend(this,b);this.rules=[];b&&b.rules&&this.addRules(b.rules);this.setDefaultStyle(a||OpenLayers.Feature.Vector.style["default"]);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){for(var a=0,b=this.rules.length;a<b;a++)this.rules[a].destroy(),this.rules[a]=null;this.defaultStyle=this.rules=null},createSymbolizer:function(a){for(var b=this.defaultsPerSymbolizer?{}:this.createLiterals(OpenLayers.Util.extend({},this.defaultStyle),a),c=this.rules,d,e=[],f=!1,g=0,h=c.length;g<h;g++)d=c[g],d.evaluate(a)&&(d instanceof OpenLayers.Rule&&d.elseFilter?e.push(d):(f=!0,this.applySymbolizer(d,b,a)));if(!1==f&&0<e.length){f=!0;g=0;for(h=e.length;g<h;g++)this.applySymbolizer(e[g],b,a)}0<c.length&&!1==f&&(b.display="none");null!=b.label&&"string"!==typeof b.label&&(b.label=""+b.label);return b},applySymbolizer:function(a,b,c){var d=c.geometry?this.getSymbolizerPrefix(c.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0],a=a.symbolizer[d]||a.symbolizer;!0===this.defaultsPerSymbolizer&&(d=this.defaultStyle,OpenLayers.Util.applyDefaults(a,{pointRadius:d.pointRadius}),(!0===a.stroke||!0===a.graphic)&&OpenLayers.Util.applyDefaults(a,{strokeWidth:d.strokeWidth,strokeColor:d.strokeColor,strokeOpacity:d.strokeOpacity,strokeDashstyle:d.strokeDashstyle,strokeLinecap:d.strokeLinecap}),(!0===a.fill||!0===a.graphic)&&OpenLayers.Util.applyDefaults(a,{fillColor:d.fillColor,fillOpacity:d.fillOpacity}),!0===a.graphic&&OpenLayers.Util.applyDefaults(a,{pointRadius:this.defaultStyle.pointRadius,externalGraphic:this.defaultStyle.externalGraphic,graphicName:this.defaultStyle.graphicName,graphicOpacity:this.defaultStyle.graphicOpacity,graphicWidth:this.defaultStyle.graphicWidth,graphicHeight:this.defaultStyle.graphicHeight,graphicXOffset:this.defaultStyle.graphicXOffset,graphicYOffset:this.defaultStyle.graphicYOffset}));return this.createLiterals(OpenLayers.Util.extend(b,a),c)},createLiterals:function(a,b){var c=OpenLayers.Util.extend({},b.attributes||b.data);OpenLayers.Util.extend(c,this.context);for(var d in this.propertyStyles)a[d]=OpenLayers.Style.createLiteral(a[d],c,b,d);return a},findPropertyStyles:function(){var a={};this.addPropertyStyles(a,this.defaultStyle);for(var b=this.rules,c,d,e=0,f=b.length;e<f;e++){c=b[e].symbolizer;for(var g in c)if(d=c[g],"object"==typeof d)this.addPropertyStyles(a,d);else{this.addPropertyStyles(a,c);break}}return a},addPropertyStyles:function(a,b){var c,d;for(d in b)c=b[d],"string"==typeof c&&c.match(/\$\{\w+\}/)&&(a[d]=!0);return a},addRules:function(a){Array.prototype.push.apply(this.rules,a);this.propertyStyles=this.findPropertyStyles()},setDefaultStyle:function(a){this.defaultStyle=a;this.propertyStyles=this.findPropertyStyles()},getSymbolizerPrefix:function(a){for(var b=OpenLayers.Style.SYMBOLIZER_PREFIXES,c=0,d=b.length;c<d;c++)if(-1!=a.CLASS_NAME.indexOf(b[c]))return b[c]},clone:function(){var a=OpenLayers.Util.extend({},this);if(this.rules){a.rules=[];for(var b=0,c=this.rules.length;b<c;++b)a.rules.push(this.rules[b].clone())}a.context=this.context&&OpenLayers.Util.extend({},this.context);b=OpenLayers.Util.extend({},this.defaultStyle);return new OpenLayers.Style(b,a)},CLASS_NAME:"OpenLayers.Style"});OpenLayers.Style.createLiteral=function(a,b,c,d){"string"==typeof a&&-1!=a.indexOf("${")&&(a=OpenLayers.String.format(a,b,[c,d]),a=isNaN(a)||!a?a:parseFloat(a));return a};OpenLayers.Style.SYMBOLIZER_PREFIXES=["Point","Line","Polygon","Text","Raster"];OpenLayers.Filter=OpenLayers.Class({initialize:function(a){OpenLayers.Util.extend(this,a)},destroy:function(){},evaluate:function(){return!0},clone:function(){return null},toString:function(){return OpenLayers.Format&&OpenLayers.Format.CQL?OpenLayers.Format.CQL.prototype.write(this):Object.prototype.toString.call(this)},CLASS_NAME:"OpenLayers.Filter"});OpenLayers.Filter.FeatureId=OpenLayers.Class(OpenLayers.Filter,{fids:null,type:"FID",initialize:function(a){this.fids=[];OpenLayers.Filter.prototype.initialize.apply(this,[a])},evaluate:function(a){for(var b=0,c=this.fids.length;b<c;b++)if((a.fid||a.id)==this.fids[b])return!0;return!1},clone:function(){var a=new OpenLayers.Filter.FeatureId;OpenLayers.Util.extend(a,this);a.fids=this.fids.slice();return a},CLASS_NAME:"OpenLayers.Filter.FeatureId"});OpenLayers.Filter.Logical=OpenLayers.Class(OpenLayers.Filter,{filters:null,type:null,initialize:function(a){this.filters=[];OpenLayers.Filter.prototype.initialize.apply(this,[a])},destroy:function(){this.filters=null;OpenLayers.Filter.prototype.destroy.apply(this)},evaluate:function(a){var b,c;switch(this.type){case OpenLayers.Filter.Logical.AND:b=0;for(c=this.filters.length;b<c;b++)if(!1==this.filters[b].evaluate(a))return!1;return!0;case OpenLayers.Filter.Logical.OR:b=0;for(c=this.filters.length;b<c;b++)if(!0==this.filters[b].evaluate(a))return!0;return!1;case OpenLayers.Filter.Logical.NOT:return!this.filters[0].evaluate(a)}},clone:function(){for(var a=[],b=0,c=this.filters.length;b<c;++b)a.push(this.filters[b].clone());return new OpenLayers.Filter.Logical({type:this.type,filters:a})},CLASS_NAME:"OpenLayers.Filter.Logical"});OpenLayers.Filter.Logical.AND="&&";OpenLayers.Filter.Logical.OR="||";OpenLayers.Filter.Logical.NOT="!";OpenLayers.Filter.Comparison=OpenLayers.Class(OpenLayers.Filter,{type:null,property:null,value:null,matchCase:!0,lowerBoundary:null,upperBoundary:null,initialize:function(a){OpenLayers.Filter.prototype.initialize.apply(this,[a]);this.type===OpenLayers.Filter.Comparison.LIKE&&void 0===a.matchCase&&(this.matchCase=null)},evaluate:function(a){a instanceof OpenLayers.Feature.Vector&&(a=a.attributes);var b=!1,a=a[this.property];switch(this.type){case OpenLayers.Filter.Comparison.EQUAL_TO:b=this.value;b=!this.matchCase&&"string"==typeof a&&"string"==typeof b?a.toUpperCase()==b.toUpperCase():a==b;break;case OpenLayers.Filter.Comparison.NOT_EQUAL_TO:b=this.value;b=!this.matchCase&&"string"==typeof a&&"string"==typeof b?a.toUpperCase()!=b.toUpperCase():a!=b;break;case OpenLayers.Filter.Comparison.LESS_THAN:b=a<this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN:b=a>this.value;break;case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:b=a<=this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:b=a>=this.value;break;case OpenLayers.Filter.Comparison.BETWEEN:b=a>=this.lowerBoundary&&a<=this.upperBoundary;break;case OpenLayers.Filter.Comparison.LIKE:b=RegExp(this.value,"gi").test(a)}return b},value2regex:function(a,b,c){if("."==a)throw Error("'.' is an unsupported wildCard character for OpenLayers.Filter.Comparison");a=a?a:"*";b=b?b:".";this.value=this.value.replace(RegExp("\\"+(c?c:"!")+"(.|$)","g"),"\\$1");this.value=this.value.replace(RegExp("\\"+b,"g"),".");this.value=this.value.replace(RegExp("\\"+a,"g"),".*");this.value=this.value.replace(RegExp("\\\\.\\*","g"),"\\"+a);return this.value=this.value.replace(RegExp("\\\\\\.","g"),"\\"+b)},regex2value:function(){var a=this.value,a=a.replace(/!/g,"!!"),a=a.replace(/(\\)?\\\./g,function(a,c){return c?a:"!."}),a=a.replace(/(\\)?\\\*/g,function(a,c){return c?a:"!*"}),a=a.replace(/\\\\/g,"\\");return a=a.replace(/\.\*/g,"*")},clone:function(){return OpenLayers.Util.extend(new OpenLayers.Filter.Comparison,this)},CLASS_NAME:"OpenLayers.Filter.Comparison"});OpenLayers.Filter.Comparison.EQUAL_TO="==";OpenLayers.Filter.Comparison.NOT_EQUAL_TO="!=";OpenLayers.Filter.Comparison.LESS_THAN="<";OpenLayers.Filter.Comparison.GREATER_THAN=">";OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO="<=";OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO=">=";OpenLayers.Filter.Comparison.BETWEEN="..";OpenLayers.Filter.Comparison.LIKE="~";OpenLayers.Format.Filter=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{defaultVersion:"1.0.0",CLASS_NAME:"OpenLayers.Format.Filter"});OpenLayers.Filter.Function=OpenLayers.Class(OpenLayers.Filter,{name:null,params:null,CLASS_NAME:"OpenLayers.Filter.Function"});OpenLayers.Format.Filter.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ogc:"http://www.opengis.net/ogc",gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},defaultPrefix:"ogc",schemaLocation:null,initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(a){var b={};this.readers.ogc.Filter.apply(this,[a,b]);return b.filter},readers:{ogc:{_expression:function(a){for(var b="",c=a.firstChild;c;c=c.nextSibling)switch(c.nodeType){case 1:a=this.readNode(c);a.property?b+="${"+a.property+"}":void 0!==a.value&&(b+=a.value);break;case 3:case 4:b+=c.nodeValue}return b},Filter:function(a,b){var c={fids:[],filters:[]};this.readChildNodes(a,c);0<c.fids.length?b.filter=new OpenLayers.Filter.FeatureId({fids:c.fids}):0<c.filters.length&&(b.filter=c.filters[0])},FeatureId:function(a,b){var c=a.getAttribute("fid");c&&b.fids.push(c)},And:function(a,b){var c=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND});this.readChildNodes(a,c);b.filters.push(c)},Or:function(a,b){var c=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.OR});this.readChildNodes(a,c);b.filters.push(c)},Not:function(a,b){var c=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.NOT});this.readChildNodes(a,c);b.filters.push(c)},PropertyIsLessThan:function(a,b){var c=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.LESS_THAN});this.readChildNodes(a,c);b.filters.push(c)},PropertyIsGreaterThan:function(a,b){var c=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.GREATER_THAN});this.readChildNodes(a,c);b.filters.push(c)},PropertyIsLessThanOrEqualTo:function(a,b){var c=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO});this.readChildNodes(a,c);b.filters.push(c)},PropertyIsGreaterThanOrEqualTo:function(a,b){var c=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO});this.readChildNodes(a,c);b.filters.push(c)},PropertyIsBetween:function(a,b){var c=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.BETWEEN});this.readChildNodes(a,c);b.filters.push(c)},Literal:function(a,b){b.value=OpenLayers.String.numericIf(this.getChildValue(a))},PropertyName:function(a,b){b.property=this.getChildValue(a)},LowerBoundary:function(a,b){b.lowerBoundary=OpenLayers.String.numericIf(this.readers.ogc._expression.call(this,a))},UpperBoundary:function(a,b){b.upperBoundary=OpenLayers.String.numericIf(this.readers.ogc._expression.call(this,a))},Intersects:function(a,b){this.readSpatial(a,b,OpenLayers.Filter.Spatial.INTERSECTS)},Within:function(a,b){this.readSpatial(a,b,OpenLayers.Filter.Spatial.WITHIN)},Contains:function(a,b){this.readSpatial(a,b,OpenLayers.Filter.Spatial.CONTAINS)},DWithin:function(a,b){this.readSpatial(a,b,OpenLayers.Filter.Spatial.DWITHIN)},Distance:function(a,b){b.distance=parseInt(this.getChildValue(a));b.distanceUnits=a.getAttribute("units")},Function:function(){}}},readSpatial:function(a,b,c){c=new OpenLayers.Filter.Spatial({type:c});this.readChildNodes(a,c);c.value=c.components[0];delete c.components;b.filters.push(c)},writeOgcExpression:function(a,b){if(a instanceof OpenLayers.Filter.Function){var c=this.writeNode("Function",a,b);b.appendChild(c)}else this.writeNode("Literal",a,b);return b},write:function(a){return this.writers.ogc.Filter.apply(this,[a])},writeFeatureIdNodes:function(a,b){for(var c=0,d=a.fids.length;c<d;++c)this.writeNode("FeatureId",a.fids[c],b)},writers:{ogc:{Filter:function(a){var b=this.createElementNSPlus("ogc:Filter");"FID"===a.type?OpenLayers.Format.Filter.v1.prototype.writeFeatureIdNodes.call(this,a,b):this.writeNode(this.getFilterType(a),a,b);return b},FeatureId:function(a){return this.createElementNSPlus("ogc:FeatureId",{attributes:{fid:a}})},And:function(a){for(var b=this.createElementNSPlus("ogc:And"),c,d=0,e=a.filters.length;d<e;++d)c=a.filters[d],"FID"===c.type?OpenLayers.Format.Filter.v1.prototype.writeFeatureIdNodes.call(this,c,b):this.writeNode(this.getFilterType(c),c,b);return b},Or:function(a){for(var b=this.createElementNSPlus("ogc:Or"),c,d=0,e=a.filters.length;d<e;++d)c=a.filters[d],"FID"===c.type?OpenLayers.Format.Filter.v1.prototype.writeFeatureIdNodes.call(this,c,b):this.writeNode(this.getFilterType(c),c,b);return b},Not:function(a){var b=this.createElementNSPlus("ogc:Not"),a=a.filters[0];"FID"===a.type?OpenLayers.Format.Filter.v1.prototype.writeFeatureIdNodes.call(this,a,b):this.writeNode(this.getFilterType(a),a,b);return b},PropertyIsLessThan:function(a){var b=this.createElementNSPlus("ogc:PropertyIsLessThan");this.writeNode("PropertyName",a,b);this.writeOgcExpression(a.value,b);return b},PropertyIsGreaterThan:function(a){var b=this.createElementNSPlus("ogc:PropertyIsGreaterThan");this.writeNode("PropertyName",a,b);this.writeOgcExpression(a.value,b);return b},PropertyIsLessThanOrEqualTo:function(a){var b=this.createElementNSPlus("ogc:PropertyIsLessThanOrEqualTo");this.writeNode("PropertyName",a,b);this.writeOgcExpression(a.value,b);return b},PropertyIsGreaterThanOrEqualTo:function(a){var b=this.createElementNSPlus("ogc:PropertyIsGreaterThanOrEqualTo");this.writeNode("PropertyName",a,b);this.writeOgcExpression(a.value,b);return b},PropertyIsBetween:function(a){var b=this.createElementNSPlus("ogc:PropertyIsBetween");this.writeNode("PropertyName",a,b);this.writeNode("LowerBoundary",a,b);this.writeNode("UpperBoundary",a,b);return b},PropertyName:function(a){return this.createElementNSPlus("ogc:PropertyName",{value:a.property})},Literal:function(a){return this.createElementNSPlus("ogc:Literal",{value:a})},LowerBoundary:function(a){var b=this.createElementNSPlus("ogc:LowerBoundary");this.writeOgcExpression(a.lowerBoundary,b);return b},UpperBoundary:function(a){var b=this.createElementNSPlus("ogc:UpperBoundary");this.writeNode("Literal",a.upperBoundary,b);return b},INTERSECTS:function(a){return this.writeSpatial(a,"Intersects")},WITHIN:function(a){return this.writeSpatial(a,"Within")},CONTAINS:function(a){return this.writeSpatial(a,"Contains")},DWITHIN:function(a){var b=this.writeSpatial(a,"DWithin");this.writeNode("Distance",a,b);return b},Distance:function(a){return this.createElementNSPlus("ogc:Distance",{attributes:{units:a.distanceUnits},value:a.distance})},Function:function(a){for(var b=this.createElementNSPlus("ogc:Function",{attributes:{name:a.name}}),a=a.params,c=0,d=a.length;c<d;c++)this.writeOgcExpression(a[c],b);return b}}},getFilterType:function(a){var b=this.filterMap[a.type];if(!b)throw"Filter writing not supported for rule type: "+a.type;return b},filterMap:{"&&":"And","||":"Or","!":"Not","==":"PropertyIsEqualTo","!=":"PropertyIsNotEqualTo","<":"PropertyIsLessThan",">":"PropertyIsGreaterThan","<=":"PropertyIsLessThanOrEqualTo",">=":"PropertyIsGreaterThanOrEqualTo","..":"PropertyIsBetween","~":"PropertyIsLike",BBOX:"BBOX",DWITHIN:"DWITHIN",WITHIN:"WITHIN",CONTAINS:"CONTAINS",INTERSECTS:"INTERSECTS",FID:"FeatureId"},CLASS_NAME:"OpenLayers.Format.Filter.v1"});OpenLayers.Geometry=OpenLayers.Class({id:null,parent:null,bounds:null,initialize:function(){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){this.bounds=this.id=null},clone:function(){return new OpenLayers.Geometry},setBounds:function(a){a&&(this.bounds=a.clone())},clearBounds:function(){this.bounds=null;this.parent&&this.parent.clearBounds()},extendBounds:function(a){this.getBounds()?this.bounds.extend(a):this.setBounds(a)},getBounds:function(){null==this.bounds&&this.calculateBounds();return this.bounds},calculateBounds:function(){},distanceTo:function(){},getVertices:function(){},atPoint:function(a,b,c){var d=!1;null!=this.getBounds()&&null!=a&&(b=null!=b?b:0,c=null!=c?c:0,d=new OpenLayers.Bounds(this.bounds.left-b,this.bounds.bottom-c,this.bounds.right+b,this.bounds.top+c).containsLonLat(a));return d},getLength:function(){return 0},getArea:function(){return 0},getCentroid:function(){return null},toString:function(){return OpenLayers.Format&&OpenLayers.Format.WKT?OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this)):Object.prototype.toString.call(this)},CLASS_NAME:"OpenLayers.Geometry"});OpenLayers.Geometry.fromWKT=function(a){var b;if(OpenLayers.Format&&OpenLayers.Format.WKT){var c=OpenLayers.Geometry.fromWKT.format;c||(c=new OpenLayers.Format.WKT,OpenLayers.Geometry.fromWKT.format=c);a=c.read(a);if(a instanceof OpenLayers.Feature.Vector)b=a.geometry;else if(OpenLayers.Util.isArray(a)){b=a.length;for(var c=Array(b),d=0;d<b;++d)c[d]=a[d].geometry;b=new OpenLayers.Geometry.Collection(c)}}return b};OpenLayers.Geometry.segmentsIntersect=function(a,b,c){var d=c&&c.point,c=c&&c.tolerance,e=!1,f=a.x1-b.x1,g=a.y1-b.y1,h=a.x2-a.x1,i=a.y2-a.y1,j=b.y2-b.y1,k=b.x2-b.x1,l=j*h-k*i,j=k*g-j*f,g=h*g-i*f;0==l?0==j&&0==g&&(e=!0):(f=j/l,l=g/l,0<=f&&(1>=f&&0<=l&&1>=l)&&(d?(h=a.x1+f*h,l=a.y1+f*i,e=new OpenLayers.Geometry.Point(h,l)):e=!0));if(c)if(e){if(d){a=[a,b];b=0;a:for(;2>b;++b){f=a[b];for(i=1;3>i;++i)if(h=f["x"+i],l=f["y"+i],d=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(l-e.y,2)),d<c){e.x=h;e.y=l;break a}}}}else{a=[a,b];b=0;a:for(;2>b;++b){h=a[b];l=a[(b+1)%2];for(i=1;3>i;++i)if(f={x:h["x"+i],y:h["y"+i]},g=OpenLayers.Geometry.distanceToSegment(f,l),g.distance<c){e=d?new OpenLayers.Geometry.Point(f.x,f.y):!0;break a}}}return e};OpenLayers.Geometry.distanceToSegment=function(a,b){var c=a.x,d=a.y,e=b.x1,f=b.y1,g=b.x2,h=b.y2,i=g-e,j=h-f,k=(i*(c-e)+j*(d-f))/(Math.pow(i,2)+Math.pow(j,2));0>=k||(1<=k?(e=g,f=h):(e+=k*i,f+=k*j));return{distance:Math.sqrt(Math.pow(e-c,2)+Math.pow(f-d,2)),x:e,y:f}};OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(a,b){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=parseFloat(a);this.y=parseFloat(b)},clone:function(a){null==a&&(a=new OpenLayers.Geometry.Point(this.x,this.y));OpenLayers.Util.applyDefaults(a,this);return a},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x,this.y)},distanceTo:function(a,b){var c=!(b&&!1===b.edge)&&b&&b.details,d,e,f,g,h;a instanceof OpenLayers.Geometry.Point?(e=this.x,f=this.y,g=a.x,h=a.y,d=Math.sqrt(Math.pow(e-g,2)+Math.pow(f-h,2)),d=!c?d:{x0:e,y0:f,x1:g,y1:h,distance:d}):(d=a.distanceTo(this,b),c&&(d={x0:d.x1,y0:d.y1,x1:d.x0,y1:d.y0,distance:d.distance}));return d},equals:function(a){var b=!1;null!=a&&(b=this.x==a.x&&this.y==a.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y));return b},toShortString:function(){return this.x+", "+this.y},move:function(a,b){this.x+=a;this.y+=b;this.clearBounds()},rotate:function(a,b){var a=a*(Math.PI/180),c=this.distanceTo(b),d=a+Math.atan2(this.y-b.y,this.x-b.x);this.x=b.x+c*Math.cos(d);this.y=b.y+c*Math.sin(d);this.clearBounds()},getCentroid:function(){return new OpenLayers.Geometry.Point(this.x,this.y)},resize:function(a,b,c){this.x=b.x+a*(void 0==c?1:c)*(this.x-b.x);this.y=b.y+a*(this.y-b.y);this.clearBounds();return this},intersects:function(a){var b=!1;return b="OpenLayers.Geometry.Point"==a.CLASS_NAME?this.equals(a):a.intersects(this)},transform:function(a,b){a&&b&&(OpenLayers.Projection.transform(this,a,b),this.bounds=null);return this},getVertices:function(){return[this]},CLASS_NAME:"OpenLayers.Geometry.Point"});OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(a){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];null!=a&&this.addComponents(a)},destroy:function(){this.components.length=0;this.components=null;OpenLayers.Geometry.prototype.destroy.apply(this,arguments)},clone:function(){for(var a=eval("new "+this.CLASS_NAME+"()"),b=0,c=this.components.length;b<c;b++)a.addComponent(this.components[b].clone());OpenLayers.Util.applyDefaults(a,this);return a},getComponentsString:function(){for(var a=[],b=0,c=this.components.length;b<c;b++)a.push(this.components[b].toShortString());return a.join(",")},calculateBounds:function(){this.bounds=null;var a=new OpenLayers.Bounds,b=this.components;if(b)for(var c=0,d=b.length;c<d;c++)a.extend(b[c].getBounds());null!=a.left&&(null!=a.bottom&&null!=a.right&&null!=a.top)&&this.setBounds(a)},addComponents:function(a){OpenLayers.Util.isArray(a)||(a=[a]);for(var b=0,c=a.length;b<c;b++)this.addComponent(a[b])},addComponent:function(a,b){var c=!1;if(a&&(null==this.componentTypes||-1<OpenLayers.Util.indexOf(this.componentTypes,a.CLASS_NAME))){if(null!=b&&b<this.components.length){var c=this.components.slice(0,b),d=this.components.slice(b,this.components.length);c.push(a);this.components=c.concat(d)}else this.components.push(a);a.parent=this;this.clearBounds();c=!0}return c},removeComponents:function(a){var b=!1;OpenLayers.Util.isArray(a)||(a=[a]);for(var c=a.length-1;0<=c;--c)b=this.removeComponent(a[c])||b;return b},removeComponent:function(a){OpenLayers.Util.removeItem(this.components,a);this.clearBounds();return!0},getLength:function(){for(var a=0,b=0,c=this.components.length;b<c;b++)a+=this.components[b].getLength();return a},getArea:function(){for(var a=0,b=0,c=this.components.length;b<c;b++)a+=this.components[b].getArea();return a},getGeodesicArea:function(a){for(var b=0,c=0,d=this.components.length;c<d;c++)b+=this.components[c].getGeodesicArea(a);return b},getCentroid:function(a){if(!a)return this.components.length&&this.components[0].getCentroid();a=this.components.length;if(!a)return!1;for(var b=[],c=[],d=0,e=Number.MAX_VALUE,f,g=0;g<a;++g){f=this.components[g];var h=f.getArea();f=f.getCentroid(!0);!isNaN(h)&&(!isNaN(f.x)&&!isNaN(f.y))&&(b.push(h),d+=h,e=h<e&&0<h?h:e,c.push(f))}a=b.length;if(0===d){for(g=0;g<a;++g)b[g]=1;d=b.length}else{for(g=0;g<a;++g)b[g]/=e;d/=e}for(var i=e=0,g=0;g<a;++g)f=c[g],h=b[g],e+=f.x*h,i+=f.y*h;return new OpenLayers.Geometry.Point(e/d,i/d)},getGeodesicLength:function(a){for(var b=0,c=0,d=this.components.length;c<d;c++)b+=this.components[c].getGeodesicLength(a);return b},move:function(a,b){for(var c=0,d=this.components.length;c<d;c++)this.components[c].move(a,b)},rotate:function(a,b){for(var c=0,d=this.components.length;c<d;++c)this.components[c].rotate(a,b)},resize:function(a,b,c){for(var d=0;d<this.components.length;++d)this.components[d].resize(a,b,c);return this},distanceTo:function(a,b){for(var c=!(b&&!1===b.edge)&&b&&b.details,d,e,f,g=Number.POSITIVE_INFINITY,h=0,i=this.components.length;h<i&&!(d=this.components[h].distanceTo(a,b),f=c?d.distance:d,f<g&&(g=f,e=d,0==g));++h);return e},equals:function(a){var b=!0;if(!a||!a.CLASS_NAME||this.CLASS_NAME!=a.CLASS_NAME)b=!1;else if(!OpenLayers.Util.isArray(a.components)||a.components.length!=this.components.length)b=!1;else for(var c=0,d=this.components.length;c<d;++c)if(!this.components[c].equals(a.components[c])){b=!1;break}return b},transform:function(a,b){if(a&&b){for(var c=0,d=this.components.length;c<d;c++)this.components[c].transform(a,b);this.bounds=null}return this},intersects:function(a){for(var b=!1,c=0,d=this.components.length;c<d&&!(b=a.intersects(this.components[c]));++c);return b},getVertices:function(a){for(var b=[],c=0,d=this.components.length;c<d;++c)Array.prototype.push.apply(b,this.components[c].getVertices(a));return b},CLASS_NAME:"OpenLayers.Geometry.Collection"});OpenLayers.Geometry.MultiPoint=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Point"],addPoint:function(a,b){this.addComponent(a,b)},removePoint:function(a){this.removeComponent(a)},CLASS_NAME:"OpenLayers.Geometry.MultiPoint"});OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],getLength:function(){var a=0;if(this.components&&1<this.components.length)for(var b=1,c=this.components.length;b<c;b++)a+=this.components[b-1].distanceTo(this.components[b]);return a},getGeodesicLength:function(a){var b=this;if(a){var c=new OpenLayers.Projection("EPSG:4326");c.equals(a)||(b=this.clone().transform(a,c))}a=0;if(b.components&&1<b.components.length)for(var d,e=1,f=b.components.length;e<f;e++)c=b.components[e-1],d=b.components[e],a+=OpenLayers.Util.distVincenty({lon:c.x,lat:c.y},{lon:d.x,lat:d.y});return 1e3*a},CLASS_NAME:"OpenLayers.Geometry.Curve"});OpenLayers.Geometry.LineString=OpenLayers.Class(OpenLayers.Geometry.Curve,{removeComponent:function(a){var b=this.components&&2<this.components.length;b&&OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);return b},intersects:function(a){var b=!1,c=a.CLASS_NAME;if("OpenLayers.Geometry.LineString"==c||"OpenLayers.Geometry.LinearRing"==c||"OpenLayers.Geometry.Point"==c){var d=this.getSortedSegments(),a="OpenLayers.Geometry.Point"==c?[{x1:a.x,y1:a.y,x2:a.x,y2:a.y}]:a.getSortedSegments(),e,f,g,h,i,j,k,l=0,m=d.length;a:for(;l<m;++l){c=d[l];e=c.x1;f=c.x2;g=c.y1;h=c.y2;var n=0,o=a.length;for(;n<o;++n){i=a[n];if(i.x1>f)break;if(!(i.x2<e)&&(j=i.y1,k=i.y2,!(Math.min(j,k)>Math.max(g,h))&&!(Math.max(j,k)<Math.min(g,h))&&OpenLayers.Geometry.segmentsIntersect(c,i))){b=!0;break a}}}}else b=a.intersects(this);return b},getSortedSegments:function(){for(var a=this.components.length-1,b=Array(a),c,d,e=0;e<a;++e)c=this.components[e],d=this.components[e+1],b[e]=c.x<d.x?{x1:c.x,y1:c.y,x2:d.x,y2:d.y}:{x1:d.x,y1:d.y,x2:c.x,y2:c.y};return b.sort(function(a,b){return a.x1-b.x1})},splitWithSegment:function(a,b){for(var c=!(b&&!1===b.edge),d=b&&b.tolerance,e=[],f=this.getVertices(),g=[],h=[],i=!1,j,k,l,m={point:!0,tolerance:d},n=null,o=0,p=f.length-2;o<=p;++o)if(d=f[o],g.push(d.clone()),j=f[o+1],k={x1:d.x,y1:d.y,x2:j.x,y2:j.y},k=OpenLayers.Geometry.segmentsIntersect(a,k,m),k instanceof OpenLayers.Geometry.Point&&((l=k.x===a.x1&&k.y===a.y1||k.x===a.x2&&k.y===a.y2||k.equals(d)||k.equals(j)?!0:!1)||c))k.equals(h[h.length-1])||h.push(k.clone()),!(0===o&&k.equals(d))&&!k.equals(j)&&(i=!0,k.equals(d)||g.push(k),e.push(new OpenLayers.Geometry.LineString(g)),g=[k.clone()]);i&&(g.push(j.clone()),e.push(new OpenLayers.Geometry.LineString(g)));if(0<h.length)var q=a.x1<a.x2?1:-1,r=a.y1<a.y2?1:-1,n={lines:e,points:h.sort(function(a,b){return q*a.x-q*b.x||r*a.y-r*b.y})};return n},split:function(a,b){var c=null,d=b&&b.mutual,e,f,g,h;if(a instanceof OpenLayers.Geometry.LineString){var i=this.getVertices(),j,k,l,m,n,o=[];g=[];for(var p=0,q=i.length-2;p<=q;++p){j=i[p];k=i[p+1];l={x1:j.x,y1:j.y,x2:k.x,y2:k.y};h=h||[a];d&&o.push(j.clone());for(var r=0;r<h.length;++r)if(m=h[r].splitWithSegment(l,b))if(n=m.lines,0<n.length&&(n.unshift(r,1),Array.prototype.splice.apply(h,n),r+=n.length-2),d)for(var s=0,t=m.points.length;s<t;++s)n=m.points[s],n.equals(j)||(o.push(n),g.push(new OpenLayers.Geometry.LineString(o)),o=n.equals(k)?[]:[n.clone()])}d&&(0<g.length&&0<o.length)&&(o.push(k.clone()),g.push(new OpenLayers.Geometry.LineString(o)))}else c=a.splitWith(this,b);h&&1<h.length?f=!0:h=[];g&&1<g.length?e=!0:g=[];if(f||e)c=d?[g,h]:h;return c},splitWith:function(a,b){return a.split(this,b)},getVertices:function(a){return!0===a?[this.components[0],this.components[this.components.length-1]]:!1===a?this.components.slice(1,this.components.length-1):this.components.slice()},distanceTo:function(a,b){var c=!(b&&!1===b.edge)&&b&&b.details,d,e={},f=Number.POSITIVE_INFINITY;if(a instanceof OpenLayers.Geometry.Point){for(var g=this.getSortedSegments(),h=a.x,i=a.y,j,k=0,l=g.length;k<l;++k)if(j=g[k],d=OpenLayers.Geometry.distanceToSegment(a,j),d.distance<f){if(f=d.distance,e=d,0===f)break}else if(j.x2>h&&(i>j.y1&&i<j.y2||i<j.y1&&i>j.y2))break;e=c?{distance:e.distance,x0:e.x,y0:e.y,x1:h,y1:i}:e.distance}else if(a instanceof OpenLayers.Geometry.LineString){var g=this.getSortedSegments(),h=a.getSortedSegments(),m,n,o=h.length,p={point:!0},k=0,l=g.length;a:for(;k<l;++k){i=g[k];j=i.x1;n=i.y1;for(var q=0;q<o;++q)if(d=h[q],m=OpenLayers.Geometry.segmentsIntersect(i,d,p)){f=0;e={distance:0,x0:m.x,y0:m.y,x1:m.x,y1:m.y};break a}else d=OpenLayers.Geometry.distanceToSegment({x:j,y:n},d),d.distance<f&&(f=d.distance,e={distance:f,x0:j,y0:n,x1:d.x,y1:d.y})}c||(e=e.distance);0!==f&&i&&(d=a.distanceTo(new OpenLayers.Geometry.Point(i.x2,i.y2),b),k=c?d.distance:d,k<f&&(e=c?{distance:f,x0:d.x1,y0:d.y1,x1:d.x0,y1:d.y0}:k))}else e=a.distanceTo(this,b),c&&(e={distance:e.distance,x0:e.x1,y0:e.y1,x1:e.x0,y1:e.y0});return e},simplify:function(a){if(this&&null!==this){var b=this.getVertices();if(3>b.length)return this;var c=function(a,b,d,i){for(var j=0,k=0,l=b,m;l<d;l++){m=a[b];var n=a[d],o=a[l],o=Math.abs(.5*(m.x*n.y+n.x*o.y+o.x*m.y-n.x*m.y-o.x*n.y-m.x*o.y));
m=Math.sqrt(Math.pow(m.x-n.x,2)+Math.pow(m.y-n.y,2));m=2*(o/m);m>j&&(j=m,k=l)}j>i&&k!=b&&(e.push(k),c(a,b,k,i),c(a,k,d,i))},d=b.length-1,e=[];e.push(0);for(e.push(d);b[0].equals(b[d]);)d--,e.push(d);c(b,0,d,a);a=[];e.sort(function(a,b){return a-b});for(d=0;d<e.length;d++)a.push(b[e[d]]);return new OpenLayers.Geometry.LineString(a)}return this},CLASS_NAME:"OpenLayers.Geometry.LineString"});OpenLayers.Geometry.MultiLineString=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LineString"],split:function(a,b){for(var c=null,d=b&&b.mutual,e,f,g,h,i=[],j=[a],k=0,l=this.components.length;k<l;++k){f=this.components[k];g=!1;for(var m=0;m<j.length;++m)if(e=f.split(j[m],b)){if(d){g=e[0];for(var n=0,o=g.length;n<o;++n)0===n&&i.length?i[i.length-1].addComponent(g[n]):i.push(new OpenLayers.Geometry.MultiLineString([g[n]]));g=!0;e=e[1]}if(e.length){e.unshift(m,1);Array.prototype.splice.apply(j,e);break}}g||(i.length?i[i.length-1].addComponent(f.clone()):i=[new OpenLayers.Geometry.MultiLineString(f.clone())])}i&&1<i.length?g=!0:i=[];j&&1<j.length?h=!0:j=[];if(g||h)c=d?[i,j]:j;return c},splitWith:function(a,b){var c=null,d=b&&b.mutual,e,f,g,h,i,j;if(a instanceof OpenLayers.Geometry.LineString){j=[];i=[a];for(var k=0,l=this.components.length;k<l;++k){g=!1;f=this.components[k];for(var m=0;m<i.length;++m)if(e=i[m].split(f,b)){d&&(g=e[0],g.length&&(g.unshift(m,1),Array.prototype.splice.apply(i,g),m+=g.length-2),e=e[1],0===e.length&&(e=[f.clone()]));g=0;for(var n=e.length;g<n;++g)0===g&&j.length?j[j.length-1].addComponent(e[g]):j.push(new OpenLayers.Geometry.MultiLineString([e[g]]));g=!0}g||(j.length?j[j.length-1].addComponent(f.clone()):j=[new OpenLayers.Geometry.MultiLineString([f.clone()])])}}else c=a.split(this);i&&1<i.length?h=!0:i=[];j&&1<j.length?g=!0:j=[];if(h||g)c=d?[i,j]:j;return c},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"});OpenLayers.Geometry.LinearRing=OpenLayers.Class(OpenLayers.Geometry.LineString,{componentTypes:["OpenLayers.Geometry.Point"],addComponent:function(a,b){var c=!1,d=this.components.pop();if(null!=b||!a.equals(d))c=OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,arguments);OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[this.components[0]]);return c},removeComponent:function(a){var b=this.components&&3<this.components.length;b&&(this.components.pop(),OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments),OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[this.components[0]]));return b},move:function(a,b){for(var c=0,d=this.components.length;c<d-1;c++)this.components[c].move(a,b)},rotate:function(a,b){for(var c=0,d=this.components.length;c<d-1;++c)this.components[c].rotate(a,b)},resize:function(a,b,c){for(var d=0,e=this.components.length;d<e-1;++d)this.components[d].resize(a,b,c);return this},transform:function(a,b){if(a&&b){for(var c=0,d=this.components.length;c<d-1;c++)this.components[c].transform(a,b);this.bounds=null}return this},getCentroid:function(){if(this.components&&2<this.components.length){for(var a=0,b=0,c=0;c<this.components.length-1;c++)var d=this.components[c],e=this.components[c+1],a=a+(d.x+e.x)*(d.x*e.y-e.x*d.y),b=b+(d.y+e.y)*(d.x*e.y-e.x*d.y);c=-1*this.getArea();return new OpenLayers.Geometry.Point(a/(6*c),b/(6*c))}return null},getArea:function(){var a=0;if(this.components&&2<this.components.length){for(var b=a=0,c=this.components.length;b<c-1;b++)var d=this.components[b],e=this.components[b+1],a=a+(d.x+e.x)*(e.y-d.y);a=-a/2}return a},getGeodesicArea:function(a){var b=this;if(a){var c=new OpenLayers.Projection("EPSG:4326");c.equals(a)||(b=this.clone().transform(a,c))}a=0;c=b.components&&b.components.length;if(2<c){for(var d,e,f=0;f<c-1;f++)d=b.components[f],e=b.components[f+1],a+=OpenLayers.Util.rad(e.x-d.x)*(2+Math.sin(OpenLayers.Util.rad(d.y))+Math.sin(OpenLayers.Util.rad(e.y)));a=40680631590769*a/2}return a},containsPoint:function(a){for(var b=OpenLayers.Number.limitSigDigs,c=b(a.x,14),a=b(a.y,14),d=this.components.length-1,e,f,g,h,i,j=0,k=0;k<d;++k)if(e=this.components[k],g=b(e.x,14),e=b(e.y,14),f=this.components[k+1],h=b(f.x,14),f=b(f.y,14),e==f){if(a==e&&(g<=h&&c>=g&&c<=h||g>=h&&c<=g&&c>=h)){j=-1;break}}else{i=b((a-f)*((h-g)/(f-e))+h,14);if(i==c&&(e<f&&a>=e&&a<=f||e>f&&a<=e&&a>=f)){j=-1;break}i<=c||g!=h&&(i<Math.min(g,h)||i>Math.max(g,h))||(e<f&&a>=e&&a<f||e>f&&a<e&&a>=f)&&++j}return-1==j?1:!!(j&1)},intersects:function(a){var b=!1;if("OpenLayers.Geometry.Point"==a.CLASS_NAME)b=this.containsPoint(a);else if("OpenLayers.Geometry.LineString"==a.CLASS_NAME)b=a.intersects(this);else if("OpenLayers.Geometry.LinearRing"==a.CLASS_NAME)b=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[a]);else for(var c=0,d=a.components.length;c<d&&!(b=a.components[c].intersects(this));++c);return b},getVertices:function(a){return!0===a?[]:this.components.slice(0,this.components.length-1)},CLASS_NAME:"OpenLayers.Geometry.LinearRing"});OpenLayers.Geometry.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],getArea:function(){var a=0;if(this.components&&0<this.components.length)for(var a=a+Math.abs(this.components[0].getArea()),b=1,c=this.components.length;b<c;b++)a-=Math.abs(this.components[b].getArea());return a},getGeodesicArea:function(a){var b=0;if(this.components&&0<this.components.length)for(var b=b+Math.abs(this.components[0].getGeodesicArea(a)),c=1,d=this.components.length;c<d;c++)b-=Math.abs(this.components[c].getGeodesicArea(a));return b},containsPoint:function(a){var b=this.components.length,c=!1;if(0<b&&(c=this.components[0].containsPoint(a),1!==c&&c&&1<b))for(var d,e=1;e<b;++e)if(d=this.components[e].containsPoint(a)){c=1===d?1:!1;break}return c},intersects:function(a){var b=!1,c,d;if("OpenLayers.Geometry.Point"==a.CLASS_NAME)b=this.containsPoint(a);else if("OpenLayers.Geometry.LineString"==a.CLASS_NAME||"OpenLayers.Geometry.LinearRing"==a.CLASS_NAME){c=0;for(d=this.components.length;c<d&&!(b=a.intersects(this.components[c]));++c);if(!b){c=0;for(d=a.components.length;c<d&&!(b=this.containsPoint(a.components[c]));++c);}}else{c=0;for(d=a.components.length;c<d&&!(b=this.intersects(a.components[c]));++c);}if(!b&&"OpenLayers.Geometry.Polygon"==a.CLASS_NAME){var e=this.components[0];c=0;for(d=e.components.length;c<d&&!(b=a.containsPoint(e.components[c]));++c);}return b},distanceTo:function(a,b){return b&&!1===b.edge&&this.intersects(a)?0:OpenLayers.Geometry.Collection.prototype.distanceTo.apply(this,[a,b])},CLASS_NAME:"OpenLayers.Geometry.Polygon"});OpenLayers.Geometry.Polygon.createRegularPolygon=function(a,b,c,d){var e=Math.PI*(1/c-.5);d&&(e+=d/180*Math.PI);for(var f,g=[],h=0;h<c;++h)f=e+2*h*Math.PI/c,d=a.x+b*Math.cos(f),f=a.y+b*Math.sin(f),g.push(new OpenLayers.Geometry.Point(d,f));a=new OpenLayers.Geometry.LinearRing(g);return new OpenLayers.Geometry.Polygon([a])};OpenLayers.Geometry.MultiPolygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Polygon"],CLASS_NAME:"OpenLayers.Geometry.MultiPolygon"});OpenLayers.Format.GML=OpenLayers.Class(OpenLayers.Format.XML,{featureNS:"http://mapserver.gis.umn.edu/mapserver",featurePrefix:"feature",featureName:"featureMember",layerName:"features",geometryName:"geometry",collectionName:"FeatureCollection",gmlns:"http://www.opengis.net/gml",extractAttributes:!0,xy:!0,initialize:function(a){this.regExes={trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g};OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));for(var a=this.getElementsByTagNameNS(a.documentElement,this.gmlns,this.featureName),b=[],c=0;c<a.length;c++){var d=this.parseFeature(a[c]);d&&b.push(d)}return b},parseFeature:function(a){for(var b="MultiPolygon Polygon MultiLineString LineString MultiPoint Point Envelope".split(" "),c,d,e,f=0;f<b.length;++f)if(c=b[f],d=this.getElementsByTagNameNS(a,this.gmlns,c),0<d.length){if(e=this.parseGeometry[c.toLowerCase()])e=e.apply(this,[d[0]]),this.internalProjection&&this.externalProjection&&e.transform(this.externalProjection,this.internalProjection);else throw new TypeError("Unsupported geometry type: "+c);break}var g;c=this.getElementsByTagNameNS(a,this.gmlns,"Box");for(f=0;f<c.length;++f)b=c[f],d=this.parseGeometry.box.apply(this,[b]),b=b.parentNode,"boundedBy"===(b.localName||b.nodeName.split(":").pop())?g=d:e=d.toGeometry();var h;this.extractAttributes&&(h=this.parseAttributes(a));h=new OpenLayers.Feature.Vector(e,h);h.bounds=g;h.gml={featureType:a.firstChild.nodeName.split(":")[1],featureNS:a.firstChild.namespaceURI,featureNSPrefix:a.firstChild.prefix};for(var a=a.firstChild,i;a&&!(1==a.nodeType&&(i=a.getAttribute("fid")||a.getAttribute("id")));)a=a.nextSibling;h.fid=i;return h},parseGeometry:{point:function(a){var b,c;c=[];b=this.getElementsByTagNameNS(a,this.gmlns,"pos");0<b.length&&(c=b[0].firstChild.nodeValue,c=c.replace(this.regExes.trimSpace,""),c=c.split(this.regExes.splitSpace));0==c.length&&(b=this.getElementsByTagNameNS(a,this.gmlns,"coordinates"),0<b.length&&(c=b[0].firstChild.nodeValue,c=c.replace(this.regExes.removeSpace,""),c=c.split(",")));0==c.length&&(b=this.getElementsByTagNameNS(a,this.gmlns,"coord"),0<b.length&&(a=this.getElementsByTagNameNS(b[0],this.gmlns,"X"),b=this.getElementsByTagNameNS(b[0],this.gmlns,"Y"),0<a.length&&0<b.length&&(c=[a[0].firstChild.nodeValue,b[0].firstChild.nodeValue])));2==c.length&&(c[2]=null);return this.xy?new OpenLayers.Geometry.Point(c[0],c[1],c[2]):new OpenLayers.Geometry.Point(c[1],c[0],c[2])},multipoint:function(a){var a=this.getElementsByTagNameNS(a,this.gmlns,"Point"),b=[];if(0<a.length)for(var c,d=0;d<a.length;++d)(c=this.parseGeometry.point.apply(this,[a[d]]))&&b.push(c);return new OpenLayers.Geometry.MultiPoint(b)},linestring:function(a,b){var c,d;d=[];var e=[];c=this.getElementsByTagNameNS(a,this.gmlns,"posList");if(0<c.length){d=this.getChildValue(c[0]);d=d.replace(this.regExes.trimSpace,"");d=d.split(this.regExes.splitSpace);var f=parseInt(c[0].getAttribute("dimension")),g,h,i;for(c=0;c<d.length/f;++c)g=c*f,h=d[g],i=d[g+1],g=2==f?null:d[g+2],this.xy?e.push(new OpenLayers.Geometry.Point(h,i,g)):e.push(new OpenLayers.Geometry.Point(i,h,g))}if(0==d.length&&(c=this.getElementsByTagNameNS(a,this.gmlns,"coordinates"),0<c.length)){d=this.getChildValue(c[0]);d=d.replace(this.regExes.trimSpace,"");d=d.replace(this.regExes.trimComma,",");f=d.split(this.regExes.splitSpace);for(c=0;c<f.length;++c)d=f[c].split(","),2==d.length&&(d[2]=null),this.xy?e.push(new OpenLayers.Geometry.Point(d[0],d[1],d[2])):e.push(new OpenLayers.Geometry.Point(d[1],d[0],d[2]))}d=null;0!=e.length&&(d=b?new OpenLayers.Geometry.LinearRing(e):new OpenLayers.Geometry.LineString(e));return d},multilinestring:function(a){var a=this.getElementsByTagNameNS(a,this.gmlns,"LineString"),b=[];if(0<a.length)for(var c,d=0;d<a.length;++d)(c=this.parseGeometry.linestring.apply(this,[a[d]]))&&b.push(c);return new OpenLayers.Geometry.MultiLineString(b)},polygon:function(a){var a=this.getElementsByTagNameNS(a,this.gmlns,"LinearRing"),b=[];if(0<a.length)for(var c,d=0;d<a.length;++d)(c=this.parseGeometry.linestring.apply(this,[a[d],!0]))&&b.push(c);return new OpenLayers.Geometry.Polygon(b)},multipolygon:function(a){var a=this.getElementsByTagNameNS(a,this.gmlns,"Polygon"),b=[];if(0<a.length)for(var c,d=0;d<a.length;++d)(c=this.parseGeometry.polygon.apply(this,[a[d]]))&&b.push(c);return new OpenLayers.Geometry.MultiPolygon(b)},envelope:function(a){var b=[],c,d,e=this.getElementsByTagNameNS(a,this.gmlns,"lowerCorner");if(0<e.length){c=[];0<e.length&&(c=e[0].firstChild.nodeValue,c=c.replace(this.regExes.trimSpace,""),c=c.split(this.regExes.splitSpace));2==c.length&&(c[2]=null);var f=this.xy?new OpenLayers.Geometry.Point(c[0],c[1],c[2]):new OpenLayers.Geometry.Point(c[1],c[0],c[2])}a=this.getElementsByTagNameNS(a,this.gmlns,"upperCorner");if(0<a.length){c=[];0<a.length&&(c=a[0].firstChild.nodeValue,c=c.replace(this.regExes.trimSpace,""),c=c.split(this.regExes.splitSpace));2==c.length&&(c[2]=null);var g=this.xy?new OpenLayers.Geometry.Point(c[0],c[1],c[2]):new OpenLayers.Geometry.Point(c[1],c[0],c[2])}f&&g&&(b.push(new OpenLayers.Geometry.Point(f.x,f.y)),b.push(new OpenLayers.Geometry.Point(g.x,f.y)),b.push(new OpenLayers.Geometry.Point(g.x,g.y)),b.push(new OpenLayers.Geometry.Point(f.x,g.y)),b.push(new OpenLayers.Geometry.Point(f.x,f.y)),b=new OpenLayers.Geometry.LinearRing(b),d=new OpenLayers.Geometry.Polygon([b]));return d},box:function(a){var b=this.getElementsByTagNameNS(a,this.gmlns,"coordinates"),c=a=null;0<b.length&&(b=b[0].firstChild.nodeValue,b=b.split(" "),2==b.length&&(a=b[0].split(","),c=b[1].split(",")));if(null!==a&&null!==c)return new OpenLayers.Bounds(parseFloat(a[0]),parseFloat(a[1]),parseFloat(c[0]),parseFloat(c[1]))}},parseAttributes:function(a){for(var b={},a=a.firstChild,c,d,e;a;){if(1==a.nodeType){a=a.childNodes;for(c=0;c<a.length;++c)if(d=a[c],1==d.nodeType)if(e=d.childNodes,1==e.length){if(e=e[0],3==e.nodeType||4==e.nodeType)d=d.prefix?d.nodeName.split(":")[1]:d.nodeName,e=e.nodeValue.replace(this.regExes.trimSpace,""),b[d]=e}else b[d.nodeName.split(":").pop()]=null;break}a=a.nextSibling}return b},write:function(a){OpenLayers.Util.isArray(a)||(a=[a]);for(var b=this.createElementNS("http://www.opengis.net/wfs","wfs:"+this.collectionName),c=0;c<a.length;c++)b.appendChild(this.createFeatureXML(a[c]));return OpenLayers.Format.XML.prototype.write.apply(this,[b])},createFeatureXML:function(a){var b=this.buildGeometryNode(a.geometry),c=this.createElementNS(this.featureNS,this.featurePrefix+":"+this.geometryName);c.appendChild(b);var b=this.createElementNS(this.gmlns,"gml:"+this.featureName),d=this.createElementNS(this.featureNS,this.featurePrefix+":"+this.layerName);d.setAttribute("fid",a.fid||a.id);d.appendChild(c);for(var e in a.attributes){var c=this.createTextNode(a.attributes[e]),f=this.createElementNS(this.featureNS,this.featurePrefix+":"+e.substring(e.lastIndexOf(":")+1));f.appendChild(c);d.appendChild(f)}b.appendChild(d);return b},buildGeometryNode:function(a){this.externalProjection&&this.internalProjection&&(a=a.clone(),a.transform(this.internalProjection,this.externalProjection));var b=a.CLASS_NAME;return this.buildGeometry[b.substring(b.lastIndexOf(".")+1).toLowerCase()].apply(this,[a])},buildGeometry:{point:function(a){var b=this.createElementNS(this.gmlns,"gml:Point");b.appendChild(this.buildCoordinatesNode(a));return b},multipoint:function(a){for(var b=this.createElementNS(this.gmlns,"gml:MultiPoint"),a=a.components,c,d,e=0;e<a.length;e++)c=this.createElementNS(this.gmlns,"gml:pointMember"),d=this.buildGeometry.point.apply(this,[a[e]]),c.appendChild(d),b.appendChild(c);return b},linestring:function(a){var b=this.createElementNS(this.gmlns,"gml:LineString");b.appendChild(this.buildCoordinatesNode(a));return b},multilinestring:function(a){for(var b=this.createElementNS(this.gmlns,"gml:MultiLineString"),a=a.components,c,d,e=0;e<a.length;++e)c=this.createElementNS(this.gmlns,"gml:lineStringMember"),d=this.buildGeometry.linestring.apply(this,[a[e]]),c.appendChild(d),b.appendChild(c);return b},linearring:function(a){var b=this.createElementNS(this.gmlns,"gml:LinearRing");b.appendChild(this.buildCoordinatesNode(a));return b},polygon:function(a){for(var b=this.createElementNS(this.gmlns,"gml:Polygon"),a=a.components,c,d,e=0;e<a.length;++e)c=0==e?"outerBoundaryIs":"innerBoundaryIs",c=this.createElementNS(this.gmlns,"gml:"+c),d=this.buildGeometry.linearring.apply(this,[a[e]]),c.appendChild(d),b.appendChild(c);return b},multipolygon:function(a){for(var b=this.createElementNS(this.gmlns,"gml:MultiPolygon"),a=a.components,c,d,e=0;e<a.length;++e)c=this.createElementNS(this.gmlns,"gml:polygonMember"),d=this.buildGeometry.polygon.apply(this,[a[e]]),c.appendChild(d),b.appendChild(c);return b},bounds:function(a){var b=this.createElementNS(this.gmlns,"gml:Box");b.appendChild(this.buildCoordinatesNode(a));return b}},buildCoordinatesNode:function(a){var b=this.createElementNS(this.gmlns,"gml:coordinates");b.setAttribute("decimal",".");b.setAttribute("cs",",");b.setAttribute("ts"," ");var c=[];if(a instanceof OpenLayers.Bounds)c.push(a.left+","+a.bottom),c.push(a.right+","+a.top);else for(var a=a.components?a.components:[a],d=0;d<a.length;d++)c.push(a[d].x+","+a[d].y);c=this.createTextNode(c.join(" "));b.appendChild(c);return b},CLASS_NAME:"OpenLayers.Format.GML"});OpenLayers.Format.GML||(OpenLayers.Format.GML={});OpenLayers.Format.GML.Base=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",wfs:"http://www.opengis.net/wfs"},defaultPrefix:"gml",schemaLocation:null,featureType:null,featureNS:null,geometryName:"geometry",extractAttributes:!0,srsName:null,xy:!0,geometryTypes:null,singleFeatureType:null,regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g,featureMember:/^(.*:)?featureMembers?$/},initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a]);this.setGeometryTypes();a&&a.featureNS&&this.setNamespace("feature",a.featureNS);this.singleFeatureType=!a||typeof a.featureType==="string"},read:function(a){typeof a=="string"&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));if(a&&a.nodeType==9)a=a.documentElement;var b=[];this.readNode(a,{features:b},true);if(b.length==0){var c=this.getElementsByTagNameNS(a,this.namespaces.gml,"featureMember");if(c.length)for(var a=0,d=c.length;a<d;++a)this.readNode(c[a],{features:b},true);else{c=this.getElementsByTagNameNS(a,this.namespaces.gml,"featureMembers");c.length&&this.readNode(c[0],{features:b},true)}}return b},readNode:function(a,b,c){if(c===true&&this.autoConfig===true){this.featureType=null;delete this.namespaceAlias[this.featureNS];delete this.namespaces.feature;this.featureNS=null}if(!this.featureNS&&!(a.prefix in this.namespaces)&&a.parentNode.namespaceURI==this.namespaces.gml&&this.regExes.featureMember.test(a.parentNode.nodeName)){this.featureType=a.nodeName.split(":").pop();this.setNamespace("feature",a.namespaceURI);this.featureNS=a.namespaceURI;this.autoConfig=true}return OpenLayers.Format.XML.prototype.readNode.apply(this,[a,b])},readers:{gml:{featureMember:function(a,b){this.readChildNodes(a,b)},featureMembers:function(a,b){this.readChildNodes(a,b)},name:function(a,b){b.name=this.getChildValue(a)},boundedBy:function(a,b){var c={};this.readChildNodes(a,c);if(c.components&&c.components.length>0)b.bounds=c.components[0]},Point:function(a,b){var c={points:[]};this.readChildNodes(a,c);if(!b.components)b.components=[];b.components.push(c.points[0])},coordinates:function(a,b){for(var c=this.getChildValue(a).replace(this.regExes.trimSpace,""),c=c.replace(this.regExes.trimComma,","),c=c.split(this.regExes.splitSpace),d,e=c.length,f=Array(e),g=0;g<e;++g){d=c[g].split(",");f[g]=this.xy?new OpenLayers.Geometry.Point(d[0],d[1],d[2]):new OpenLayers.Geometry.Point(d[1],d[0],d[2])}b.points=f},coord:function(a,b){var c={};this.readChildNodes(a,c);if(!b.points)b.points=[];b.points.push(new OpenLayers.Geometry.Point(c.x,c.y,c.z))},X:function(a,b){b.x=this.getChildValue(a)},Y:function(a,b){b.y=this.getChildValue(a)},Z:function(a,b){b.z=this.getChildValue(a)},MultiPoint:function(a,b){var c={components:[]};this.readChildNodes(a,c);b.components=[new OpenLayers.Geometry.MultiPoint(c.components)]},pointMember:function(a,b){this.readChildNodes(a,b)},LineString:function(a,b){var c={};this.readChildNodes(a,c);if(!b.components)b.components=[];b.components.push(new OpenLayers.Geometry.LineString(c.points))},MultiLineString:function(a,b){var c={components:[]};this.readChildNodes(a,c);b.components=[new OpenLayers.Geometry.MultiLineString(c.components)]},lineStringMember:function(a,b){this.readChildNodes(a,b)},Polygon:function(a,b){var c={outer:null,inner:[]};this.readChildNodes(a,c);c.inner.unshift(c.outer);if(!b.components)b.components=[];b.components.push(new OpenLayers.Geometry.Polygon(c.inner))},LinearRing:function(a,b){var c={};this.readChildNodes(a,c);b.components=[new OpenLayers.Geometry.LinearRing(c.points)]},MultiPolygon:function(a,b){var c={components:[]};this.readChildNodes(a,c);b.components=[new OpenLayers.Geometry.MultiPolygon(c.components)]},polygonMember:function(a,b){this.readChildNodes(a,b)},GeometryCollection:function(a,b){var c={components:[]};this.readChildNodes(a,c);b.components=[new OpenLayers.Geometry.Collection(c.components)]},geometryMember:function(a,b){this.readChildNodes(a,b)}},feature:{"*":function(a,b){var c,d=a.localName||a.nodeName.split(":").pop();b.features?!this.singleFeatureType&&OpenLayers.Util.indexOf(this.featureType,d)!==-1?c="_typeName":d===this.featureType&&(c="_typeName"):a.childNodes.length==0||a.childNodes.length==1&&a.firstChild.nodeType==3?this.extractAttributes&&(c="_attribute"):c="_geometry";c&&this.readers.feature[c].apply(this,[a,b])},_typeName:function(a,b){var c={components:[],attributes:{}};this.readChildNodes(a,c);if(c.name)c.attributes.name=c.name;var d=new OpenLayers.Feature.Vector(c.components[0],c.attributes);if(!this.singleFeatureType){d.type=a.nodeName.split(":").pop();d.namespace=a.namespaceURI}var e=a.getAttribute("fid")||this.getAttributeNS(a,this.namespaces.gml,"id");if(e)d.fid=e;this.internalProjection&&(this.externalProjection&&d.geometry)&&d.geometry.transform(this.externalProjection,this.internalProjection);if(c.bounds)d.bounds=c.bounds;b.features.push(d)},_geometry:function(a,b){if(!this.geometryName)this.geometryName=a.nodeName.split(":").pop();this.readChildNodes(a,b)},_attribute:function(a,b){var c=a.localName||a.nodeName.split(":").pop(),d=this.getChildValue(a);b.attributes[c]=d}},wfs:{FeatureCollection:function(a,b){this.readChildNodes(a,b)}}},write:function(a){a=this.writeNode("gml:"+(OpenLayers.Util.isArray(a)?"featureMembers":"featureMember"),a);this.setAttributeNS(a,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[a])},writers:{gml:{featureMember:function(a){var b=this.createElementNSPlus("gml:featureMember");this.writeNode("feature:_typeName",a,b);return b},MultiPoint:function(a){for(var b=this.createElementNSPlus("gml:MultiPoint"),a=a.components||[a],c=0,d=a.length;c<d;++c)this.writeNode("pointMember",a[c],b);return b},pointMember:function(a){var b=this.createElementNSPlus("gml:pointMember");this.writeNode("Point",a,b);return b},MultiLineString:function(a){for(var b=this.createElementNSPlus("gml:MultiLineString"),a=a.components||[a],c=0,d=a.length;c<d;++c)this.writeNode("lineStringMember",a[c],b);return b},lineStringMember:function(a){var b=this.createElementNSPlus("gml:lineStringMember");this.writeNode("LineString",a,b);return b},MultiPolygon:function(a){for(var b=this.createElementNSPlus("gml:MultiPolygon"),a=a.components||[a],c=0,d=a.length;c<d;++c)this.writeNode("polygonMember",a[c],b);return b},polygonMember:function(a){var b=this.createElementNSPlus("gml:polygonMember");this.writeNode("Polygon",a,b);return b},GeometryCollection:function(a){for(var b=this.createElementNSPlus("gml:GeometryCollection"),c=0,d=a.components.length;c<d;++c)this.writeNode("geometryMember",a.components[c],b);return b},geometryMember:function(a){var b=this.createElementNSPlus("gml:geometryMember"),a=this.writeNode("feature:_geometry",a);b.appendChild(a.firstChild);return b}},feature:{_typeName:function(a){var b=this.createElementNSPlus("feature:"+this.featureType,{attributes:{fid:a.fid}});a.geometry&&this.writeNode("feature:_geometry",a.geometry,b);for(var c in a.attributes){var d=a.attributes[c];d!=null&&this.writeNode("feature:_attribute",{name:c,value:d},b)}return b},_geometry:function(a){this.externalProjection&&this.internalProjection&&(a=a.clone().transform(this.internalProjection,this.externalProjection));var b=this.createElementNSPlus("feature:"+this.geometryName),a=this.writeNode("gml:"+this.geometryTypes[a.CLASS_NAME],a,b);this.srsName&&a.setAttribute("srsName",this.srsName);return b},_attribute:function(a){return this.createElementNSPlus("feature:"+a.name,{value:a.value})}},wfs:{FeatureCollection:function(a){for(var b=this.createElementNSPlus("wfs:FeatureCollection"),c=0,d=a.length;c<d;++c)this.writeNode("gml:featureMember",a[c],b);return b}}},setGeometryTypes:function(){this.geometryTypes={"OpenLayers.Geometry.Point":"Point","OpenLayers.Geometry.MultiPoint":"MultiPoint","OpenLayers.Geometry.LineString":"LineString","OpenLayers.Geometry.MultiLineString":"MultiLineString","OpenLayers.Geometry.Polygon":"Polygon","OpenLayers.Geometry.MultiPolygon":"MultiPolygon","OpenLayers.Geometry.Collection":"GeometryCollection"}},CLASS_NAME:"OpenLayers.Format.GML.Base"});OpenLayers.Format.GML.v3=OpenLayers.Class(OpenLayers.Format.GML.Base,{schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd",curve:!1,multiCurve:!0,surface:!1,multiSurface:!0,initialize:function(a){OpenLayers.Format.GML.Base.prototype.initialize.apply(this,[a])},readers:{gml:OpenLayers.Util.applyDefaults({featureMembers:function(a,b){this.readChildNodes(a,b)},Curve:function(a,b){var c={points:[]};this.readChildNodes(a,c);b.components||(b.components=[]);b.components.push(new OpenLayers.Geometry.LineString(c.points))},segments:function(a,b){this.readChildNodes(a,b)},LineStringSegment:function(a,b){var c={};this.readChildNodes(a,c);c.points&&Array.prototype.push.apply(b.points,c.points)},pos:function(a,b){var c=this.getChildValue(a).replace(this.regExes.trimSpace,"").split(this.regExes.splitSpace),c=this.xy?new OpenLayers.Geometry.Point(c[0],c[1],c[2]):new OpenLayers.Geometry.Point(c[1],c[0],c[2]);b.points=[c]},posList:function(a,b){for(var c=this.getChildValue(a).replace(this.regExes.trimSpace,"").split(this.regExes.splitSpace),d=parseInt(a.getAttribute("dimension"))||2,e,f,g,h=Array(c.length/d),i=0,j=c.length;i<j;i+=d)e=c[i],f=c[i+1],g=2==d?void 0:c[i+2],h[i/d]=this.xy?new OpenLayers.Geometry.Point(e,f,g):new OpenLayers.Geometry.Point(f,e,g);b.points=h},Surface:function(a,b){this.readChildNodes(a,b)},patches:function(a,b){this.readChildNodes(a,b)},PolygonPatch:function(a,b){this.readers.gml.Polygon.apply(this,[a,b])},exterior:function(a,b){var c={};this.readChildNodes(a,c);b.outer=c.components[0]},interior:function(a,b){var c={};this.readChildNodes(a,c);b.inner.push(c.components[0])},MultiCurve:function(a,b){var c={components:[]};this.readChildNodes(a,c);0<c.components.length&&(b.components=[new OpenLayers.Geometry.MultiLineString(c.components)])},curveMember:function(a,b){this.readChildNodes(a,b)},MultiSurface:function(a,b){var c={components:[]};this.readChildNodes(a,c);0<c.components.length&&(b.components=[new OpenLayers.Geometry.MultiPolygon(c.components)])},surfaceMember:function(a,b){this.readChildNodes(a,b)},surfaceMembers:function(a,b){this.readChildNodes(a,b)},pointMembers:function(a,b){this.readChildNodes(a,b)},lineStringMembers:function(a,b){this.readChildNodes(a,b)},polygonMembers:function(a,b){this.readChildNodes(a,b)},geometryMembers:function(a,b){this.readChildNodes(a,b)},Envelope:function(a,b){var c={points:Array(2)};this.readChildNodes(a,c);b.components||(b.components=[]);var d=c.points[0],c=c.points[1];b.components.push(new OpenLayers.Bounds(d.x,d.y,c.x,c.y))},lowerCorner:function(a,b){var c={};this.readers.gml.pos.apply(this,[a,c]);b.points[0]=c.points[0]},upperCorner:function(a,b){var c={};this.readers.gml.pos.apply(this,[a,c]);b.points[1]=c.points[0]}},OpenLayers.Format.GML.Base.prototype.readers.gml),feature:OpenLayers.Format.GML.Base.prototype.readers.feature,wfs:OpenLayers.Format.GML.Base.prototype.readers.wfs},write:function(a){a=this.writeNode("gml:"+(OpenLayers.Util.isArray(a)?"featureMembers":"featureMember"),a);this.setAttributeNS(a,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[a])},writers:{gml:OpenLayers.Util.applyDefaults({featureMembers:function(a){for(var b=this.createElementNSPlus("gml:featureMembers"),c=0,d=a.length;c<d;++c)this.writeNode("feature:_typeName",a[c],b);return b},Point:function(a){var b=this.createElementNSPlus("gml:Point");this.writeNode("pos",a,b);return b},pos:function(a){return this.createElementNSPlus("gml:pos",{value:this.xy?a.x+" "+a.y:a.y+" "+a.x})},LineString:function(a){var b=this.createElementNSPlus("gml:LineString");this.writeNode("posList",a.components,b);return b},Curve:function(a){var b=this.createElementNSPlus("gml:Curve");this.writeNode("segments",a,b);return b},segments:function(a){var b=this.createElementNSPlus("gml:segments");this.writeNode("LineStringSegment",a,b);return b},LineStringSegment:function(a){var b=this.createElementNSPlus("gml:LineStringSegment");this.writeNode("posList",a.components,b);return b},posList:function(a){for(var b=a.length,c=Array(b),d,e=0;e<b;++e)d=a[e],c[e]=this.xy?d.x+" "+d.y:d.y+" "+d.x;return this.createElementNSPlus("gml:posList",{value:c.join(" ")})},Surface:function(a){var b=this.createElementNSPlus("gml:Surface");this.writeNode("patches",a,b);return b},patches:function(a){var b=this.createElementNSPlus("gml:patches");this.writeNode("PolygonPatch",a,b);return b},PolygonPatch:function(a){var b=this.createElementNSPlus("gml:PolygonPatch",{attributes:{interpolation:"planar"}});this.writeNode("exterior",a.components[0],b);for(var c=1,d=a.components.length;c<d;++c)this.writeNode("interior",a.components[c],b);return b},Polygon:function(a){var b=this.createElementNSPlus("gml:Polygon");this.writeNode("exterior",a.components[0],b);for(var c=1,d=a.components.length;c<d;++c)this.writeNode("interior",a.components[c],b);return b},exterior:function(a){var b=this.createElementNSPlus("gml:exterior");this.writeNode("LinearRing",a,b);return b},interior:function(a){var b=this.createElementNSPlus("gml:interior");this.writeNode("LinearRing",a,b);return b},LinearRing:function(a){var b=this.createElementNSPlus("gml:LinearRing");this.writeNode("posList",a.components,b);return b},MultiCurve:function(a){for(var b=this.createElementNSPlus("gml:MultiCurve"),a=a.components||[a],c=0,d=a.length;c<d;++c)this.writeNode("curveMember",a[c],b);return b},curveMember:function(a){var b=this.createElementNSPlus("gml:curveMember");this.curve?this.writeNode("Curve",a,b):this.writeNode("LineString",a,b);return b},MultiSurface:function(a){for(var b=this.createElementNSPlus("gml:MultiSurface"),a=a.components||[a],c=0,d=a.length;c<d;++c)this.writeNode("surfaceMember",a[c],b);return b},surfaceMember:function(a){var b=this.createElementNSPlus("gml:surfaceMember");this.surface?this.writeNode("Surface",a,b):this.writeNode("Polygon",a,b);return b},Envelope:function(a){var b=this.createElementNSPlus("gml:Envelope");this.writeNode("lowerCorner",a,b);this.writeNode("upperCorner",a,b);this.srsName&&b.setAttribute("srsName",this.srsName);return b},lowerCorner:function(a){return this.createElementNSPlus("gml:lowerCorner",{value:this.xy?a.left+" "+a.bottom:a.bottom+" "+a.left})},upperCorner:function(a){return this.createElementNSPlus("gml:upperCorner",{value:this.xy?a.right+" "+a.top:a.top+" "+a.right})}},OpenLayers.Format.GML.Base.prototype.writers.gml),feature:OpenLayers.Format.GML.Base.prototype.writers.feature,wfs:OpenLayers.Format.GML.Base.prototype.writers.wfs},setGeometryTypes:function(){this.geometryTypes={"OpenLayers.Geometry.Point":"Point","OpenLayers.Geometry.MultiPoint":"MultiPoint","OpenLayers.Geometry.LineString":!0===this.curve?"Curve":"LineString","OpenLayers.Geometry.MultiLineString":!1===this.multiCurve?"MultiLineString":"MultiCurve","OpenLayers.Geometry.Polygon":!0===this.surface?"Surface":"Polygon","OpenLayers.Geometry.MultiPolygon":!1===this.multiSurface?"MultiPolygon":"MultiSurface","OpenLayers.Geometry.Collection":"GeometryCollection"}},CLASS_NAME:"OpenLayers.Format.GML.v3"});OpenLayers.Format.Filter.v1_1_0=OpenLayers.Class(OpenLayers.Format.GML.v3,OpenLayers.Format.Filter.v1,{VERSION:"1.1.0",
schemaLocation:"http://www.opengis.net/ogc/filter/1.1.0/filter.xsd",initialize:function(a){OpenLayers.Format.GML.v3.prototype.initialize.apply(this,[a])},readers:{ogc:OpenLayers.Util.applyDefaults({PropertyIsEqualTo:function(a,b){var c=a.getAttribute("matchCase"),c=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,matchCase:!("false"===c||"0"===c)});this.readChildNodes(a,c);b.filters.push(c)},PropertyIsNotEqualTo:function(a,b){var c=a.getAttribute("matchCase"),c=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.NOT_EQUAL_TO,matchCase:!("false"===c||"0"===c)});this.readChildNodes(a,c);b.filters.push(c)},PropertyIsLike:function(a,b){var c=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.LIKE});this.readChildNodes(a,c);var d=a.getAttribute("wildCard"),e=a.getAttribute("singleChar"),f=a.getAttribute("escapeChar");c.value2regex(d,e,f);b.filters.push(c)}},OpenLayers.Format.Filter.v1.prototype.readers.ogc),gml:OpenLayers.Format.GML.v3.prototype.readers.gml,feature:OpenLayers.Format.GML.v3.prototype.readers.feature},writers:{ogc:OpenLayers.Util.applyDefaults({PropertyIsEqualTo:function(a){var b=this.createElementNSPlus("ogc:PropertyIsEqualTo",{attributes:{matchCase:a.matchCase}});this.writeNode("PropertyName",a,b);this.writeOgcExpression(a.value,b);return b},PropertyIsNotEqualTo:function(a){var b=this.createElementNSPlus("ogc:PropertyIsNotEqualTo",{attributes:{matchCase:a.matchCase}});this.writeNode("PropertyName",a,b);this.writeOgcExpression(a.value,b);return b},PropertyIsLike:function(a){var b=this.createElementNSPlus("ogc:PropertyIsLike",{attributes:{matchCase:a.matchCase,wildCard:"*",singleChar:".",escapeChar:"!"}});this.writeNode("PropertyName",a,b);this.writeNode("Literal",a.regex2value(),b);return b},BBOX:function(a){var b=this.createElementNSPlus("ogc:BBOX");a.property&&this.writeNode("PropertyName",a,b);var c=this.writeNode("gml:Envelope",a.value);a.projection&&c.setAttribute("srsName",a.projection);b.appendChild(c);return b},SortBy:function(a){for(var b=this.createElementNSPlus("ogc:SortBy"),c=0,d=a.length;c<d;c++)this.writeNode("ogc:SortProperty",a[c],b);return b},SortProperty:function(a){var b=this.createElementNSPlus("ogc:SortProperty");this.writeNode("ogc:PropertyName",a,b);this.writeNode("ogc:SortOrder","DESC"==a.order?"DESC":"ASC",b);return b},SortOrder:function(a){return this.createElementNSPlus("ogc:SortOrder",{value:a})}},OpenLayers.Format.Filter.v1.prototype.writers.ogc),gml:OpenLayers.Format.GML.v3.prototype.writers.gml,feature:OpenLayers.Format.GML.v3.prototype.writers.feature},writeSpatial:function(a,b){var c=this.createElementNSPlus("ogc:"+b);this.writeNode("PropertyName",a,c);if(a.value instanceof OpenLayers.Filter.Function)this.writeNode("Function",a.value,c);else{var d;d=a.value instanceof OpenLayers.Geometry?this.writeNode("feature:_geometry",a.value).firstChild:this.writeNode("gml:Envelope",a.value);a.projection&&d.setAttribute("srsName",a.projection);c.appendChild(d)}return c},CLASS_NAME:"OpenLayers.Format.Filter.v1_1_0"});OpenLayers.Format.OWSCommon=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{defaultVersion:"1.0.0",getVersion:function(a){var b=this.version;b||((a=a.getAttribute("xmlns:ows"))&&"1.1"===a.substring(a.lastIndexOf("/")+1)&&(b="1.1.0"),b||(b=this.defaultVersion));return b},CLASS_NAME:"OpenLayers.Format.OWSCommon"});OpenLayers.Format.OWSCommon.v1=OpenLayers.Class(OpenLayers.Format.XML,{regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},read:function(a,b){OpenLayers.Util.applyDefaults(b,this.options);var c={};this.readChildNodes(a,c);return c},readers:{ows:{Exception:function(a,b){var c={code:a.getAttribute("exceptionCode"),locator:a.getAttribute("locator"),texts:[]};b.exceptions.push(c);this.readChildNodes(a,c)},ExceptionText:function(a,b){var c=this.getChildValue(a);b.texts.push(c)},ServiceIdentification:function(a,b){b.serviceIdentification={};this.readChildNodes(a,b.serviceIdentification)},Title:function(a,b){b.title=this.getChildValue(a)},Abstract:function(a,b){b["abstract"]=this.getChildValue(a)},Keywords:function(a,b){b.keywords={};this.readChildNodes(a,b.keywords)},Keyword:function(a,b){b[this.getChildValue(a)]=!0},ServiceType:function(a,b){b.serviceType={codeSpace:a.getAttribute("codeSpace"),value:this.getChildValue(a)}},ServiceTypeVersion:function(a,b){b.serviceTypeVersion=this.getChildValue(a)},Fees:function(a,b){b.fees=this.getChildValue(a)},AccessConstraints:function(a,b){b.accessConstraints=this.getChildValue(a)},ServiceProvider:function(a,b){b.serviceProvider={};this.readChildNodes(a,b.serviceProvider)},ProviderName:function(a,b){b.providerName=this.getChildValue(a)},ProviderSite:function(a,b){b.providerSite=this.getAttributeNS(a,this.namespaces.xlink,"href")},ServiceContact:function(a,b){b.serviceContact={};this.readChildNodes(a,b.serviceContact)},IndividualName:function(a,b){b.individualName=this.getChildValue(a)},PositionName:function(a,b){b.positionName=this.getChildValue(a)},ContactInfo:function(a,b){b.contactInfo={};this.readChildNodes(a,b.contactInfo)},Phone:function(a,b){b.phone={};this.readChildNodes(a,b.phone)},Voice:function(a,b){b.voice=this.getChildValue(a)},Address:function(a,b){b.address={};this.readChildNodes(a,b.address)},DeliveryPoint:function(a,b){b.deliveryPoint=this.getChildValue(a)},City:function(a,b){b.city=this.getChildValue(a)},AdministrativeArea:function(a,b){b.administrativeArea=this.getChildValue(a)},PostalCode:function(a,b){b.postalCode=this.getChildValue(a)},Country:function(a,b){b.country=this.getChildValue(a)},ElectronicMailAddress:function(a,b){b.electronicMailAddress=this.getChildValue(a)},Role:function(a,b){b.role=this.getChildValue(a)},OperationsMetadata:function(a,b){b.operationsMetadata={};this.readChildNodes(a,b.operationsMetadata)},Operation:function(a,b){var c=a.getAttribute("name");b[c]={};this.readChildNodes(a,b[c])},DCP:function(a,b){b.dcp={};this.readChildNodes(a,b.dcp)},HTTP:function(a,b){b.http={};this.readChildNodes(a,b.http)},Get:function(a,b){b.get||(b.get=[]);var c={url:this.getAttributeNS(a,this.namespaces.xlink,"href")};this.readChildNodes(a,c);b.get.push(c)},Post:function(a,b){b.post||(b.post=[]);var c={url:this.getAttributeNS(a,this.namespaces.xlink,"href")};this.readChildNodes(a,c);b.post.push(c)},Parameter:function(a,b){b.parameters||(b.parameters={});var c=a.getAttribute("name");b.parameters[c]={};this.readChildNodes(a,b.parameters[c])},Constraint:function(a,b){b.constraints||(b.constraints={});var c=a.getAttribute("name");b.constraints[c]={};this.readChildNodes(a,b.constraints[c])},Value:function(a,b){b[this.getChildValue(a)]=!0},OutputFormat:function(a,b){b.formats.push({value:this.getChildValue(a)});this.readChildNodes(a,b)},WGS84BoundingBox:function(a,b){var c={};c.crs=a.getAttribute("crs");b.BoundingBox?b.BoundingBox.push(c):(b.projection=c.crs,c=b);this.readChildNodes(a,c)},BoundingBox:function(a,b){this.readers.ows.WGS84BoundingBox.apply(this,[a,b])},LowerCorner:function(a,b){var c=this.getChildValue(a).replace(this.regExes.trimSpace,""),c=c.replace(this.regExes.trimComma,","),c=c.split(this.regExes.splitSpace);b.left=c[0];b.bottom=c[1]},UpperCorner:function(a,b){var c=this.getChildValue(a).replace(this.regExes.trimSpace,""),c=c.replace(this.regExes.trimComma,","),c=c.split(this.regExes.splitSpace);b.right=c[0];b.top=c[1];b.bounds=new OpenLayers.Bounds(b.left,b.bottom,b.right,b.top);delete b.left;delete b.bottom;delete b.right;delete b.top},Language:function(a,b){b.language=this.getChildValue(a)}}},writers:{ows:{BoundingBox:function(a){var b=this.createElementNSPlus("ows:BoundingBox",{attributes:{crs:a.projection}});this.writeNode("ows:LowerCorner",a,b);this.writeNode("ows:UpperCorner",a,b);return b},LowerCorner:function(a){return this.createElementNSPlus("ows:LowerCorner",{value:a.bounds.left+" "+a.bounds.bottom})},UpperCorner:function(a){return this.createElementNSPlus("ows:UpperCorner",{value:a.bounds.right+" "+a.bounds.top})},Identifier:function(a){return this.createElementNSPlus("ows:Identifier",{value:a})},Title:function(a){return this.createElementNSPlus("ows:Title",{value:a})},Abstract:function(a){return this.createElementNSPlus("ows:Abstract",{value:a})},OutputFormat:function(a){return this.createElementNSPlus("ows:OutputFormat",{value:a})}}},CLASS_NAME:"OpenLayers.Format.OWSCommon.v1"});OpenLayers.Format.OWSCommon.v1_0_0=OpenLayers.Class(OpenLayers.Format.OWSCommon.v1,{namespaces:{ows:"http://www.opengis.net/ows",xlink:"http://www.w3.org/1999/xlink"},readers:{ows:OpenLayers.Util.applyDefaults({ExceptionReport:function(a,b){b.success=!1;b.exceptionReport={version:a.getAttribute("version"),language:a.getAttribute("language"),exceptions:[]};this.readChildNodes(a,b.exceptionReport)}},OpenLayers.Format.OWSCommon.v1.prototype.readers.ows)},writers:{ows:OpenLayers.Format.OWSCommon.v1.prototype.writers.ows},CLASS_NAME:"OpenLayers.Format.OWSCommon.v1_0_0"});OpenLayers.Format.WFST.v1_1_0=OpenLayers.Class(OpenLayers.Format.Filter.v1_1_0,OpenLayers.Format.WFST.v1,{version:"1.1.0",schemaLocations:{wfs:"http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"},initialize:function(a){OpenLayers.Format.Filter.v1_1_0.prototype.initialize.apply(this,[a]);OpenLayers.Format.WFST.v1.prototype.initialize.apply(this,[a])},readNode:function(a,b){return OpenLayers.Format.GML.v3.prototype.readNode.apply(this,[a,b])},readers:{wfs:OpenLayers.Util.applyDefaults({FeatureCollection:function(a,b){b.numberOfFeatures=parseInt(a.getAttribute("numberOfFeatures"));OpenLayers.Format.WFST.v1.prototype.readers.wfs.FeatureCollection.apply(this,arguments)},TransactionResponse:function(a,b){b.insertIds=[];b.success=!1;this.readChildNodes(a,b)},TransactionSummary:function(a,b){b.success=!0},InsertResults:function(a,b){this.readChildNodes(a,b)},Feature:function(a,b){var c={fids:[]};this.readChildNodes(a,c);b.insertIds.push(c.fids[0])}},OpenLayers.Format.WFST.v1.prototype.readers.wfs),gml:OpenLayers.Format.GML.v3.prototype.readers.gml,feature:OpenLayers.Format.GML.v3.prototype.readers.feature,ogc:OpenLayers.Format.Filter.v1_1_0.prototype.readers.ogc,ows:OpenLayers.Format.OWSCommon.v1_0_0.prototype.readers.ows},writers:{wfs:OpenLayers.Util.applyDefaults({GetFeature:function(a){var b=OpenLayers.Format.WFST.v1.prototype.writers.wfs.GetFeature.apply(this,arguments);a&&this.setAttributes(b,{resultType:a.resultType,startIndex:a.startIndex,count:a.count});return b},Query:function(a){var a=OpenLayers.Util.extend({featureNS:this.featureNS,featurePrefix:this.featurePrefix,featureType:this.featureType,srsName:this.srsName},a),b=a.featurePrefix,c=this.createElementNSPlus("wfs:Query",{attributes:{typeName:(b?b+":":"")+a.featureType,srsName:a.srsName}});a.featureNS&&c.setAttribute("xmlns:"+b,a.featureNS);if(a.propertyNames)for(var b=0,d=a.propertyNames.length;b<d;b++)this.writeNode("wfs:PropertyName",{property:a.propertyNames[b]},c);a.filter&&(OpenLayers.Format.WFST.v1_1_0.prototype.setFilterProperty.call(this,a.filter),this.writeNode("ogc:Filter",a.filter,c));return c},PropertyName:function(a){return this.createElementNSPlus("wfs:PropertyName",{value:a.property})}},OpenLayers.Format.WFST.v1.prototype.writers.wfs),gml:OpenLayers.Format.GML.v3.prototype.writers.gml,feature:OpenLayers.Format.GML.v3.prototype.writers.feature,ogc:OpenLayers.Format.Filter.v1_1_0.prototype.writers.ogc},CLASS_NAME:"OpenLayers.Format.WFST.v1_1_0"});OpenLayers.Protocol=OpenLayers.Class({format:null,options:null,autoDestroy:!0,defaultFilter:null,initialize:function(a){a=a||{};OpenLayers.Util.extend(this,a);this.options=a},mergeWithDefaultFilter:function(a){return a&&this.defaultFilter?new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND,filters:[this.defaultFilter,a]}):a||this.defaultFilter||void 0},destroy:function(){this.format=this.options=null},read:function(a){a=a||{};a.filter=this.mergeWithDefaultFilter(a.filter)},create:function(){},update:function(){},"delete":function(){},commit:function(){},abort:function(){},createCallback:function(a,b,c){return OpenLayers.Function.bind(function(){a.apply(this,[b,c])},this)},CLASS_NAME:"OpenLayers.Protocol"});OpenLayers.Protocol.Response=OpenLayers.Class({code:null,requestType:null,last:!0,features:null,data:null,reqFeatures:null,priv:null,error:null,initialize:function(a){OpenLayers.Util.extend(this,a)},success:function(){return 0<this.code},CLASS_NAME:"OpenLayers.Protocol.Response"});OpenLayers.Protocol.Response.SUCCESS=1;OpenLayers.Protocol.Response.FAILURE=0;OpenLayers.Format.JSON=OpenLayers.Class(OpenLayers.Format,{indent:" ",space:" ",newline:"\n",level:0,pretty:!1,nativeJSON:function(){return!(!window.JSON||!("function"==typeof JSON.parse&&"function"==typeof JSON.stringify))}(),read:function(a,b){var c;if(this.nativeJSON)c=JSON.parse(a,b);else try{if(/^[\],:{}\s]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))&&(c=eval("("+a+")"),"function"===typeof b)){var d=function(a,c){if(c&&"object"===typeof c)for(var e in c)c.hasOwnProperty(e)&&(c[e]=d(e,c[e]));return b(a,c)};c=d("",c)}}catch(e){}this.keepData&&(this.data=c);return c},write:function(a,b){this.pretty=!!b;var c=null,d=typeof a;if(this.serialize[d])try{c=!this.pretty&&this.nativeJSON?JSON.stringify(a):this.serialize[d].apply(this,[a])}catch(e){OpenLayers.Console.error("Trouble serializing: "+e)}return c},writeIndent:function(){var a=[];if(this.pretty)for(var b=0;b<this.level;++b)a.push(this.indent);return a.join("")},writeNewline:function(){return this.pretty?this.newline:""},writeSpace:function(){return this.pretty?this.space:""},serialize:{object:function(a){if(null==a)return"null";if(a.constructor==Date)return this.serialize.date.apply(this,[a]);if(a.constructor==Array)return this.serialize.array.apply(this,[a]);var b=["{"];this.level+=1;var c,d,e,f=!1;for(c in a)a.hasOwnProperty(c)&&(d=OpenLayers.Format.JSON.prototype.write.apply(this,[c,this.pretty]),e=OpenLayers.Format.JSON.prototype.write.apply(this,[a[c],this.pretty]),null!=d&&null!=e&&(f&&b.push(","),b.push(this.writeNewline(),this.writeIndent(),d,":",this.writeSpace(),e),f=!0));this.level-=1;b.push(this.writeNewline(),this.writeIndent(),"}");return b.join("")},array:function(a){var b,c=["["];this.level+=1;for(var d=0,e=a.length;d<e;++d)b=OpenLayers.Format.JSON.prototype.write.apply(this,[a[d],this.pretty]),null!=b&&(0<d&&c.push(","),c.push(this.writeNewline(),this.writeIndent(),b));this.level-=1;c.push(this.writeNewline(),this.writeIndent(),"]");return c.join("")},string:function(a){var b={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return/["\\\x00-\x1f]/.test(a)?'"'+a.replace(/([\x00-\x1f\\"])/g,function(a,d){var e=b[d];if(e)return e;e=d.charCodeAt();return"\\u00"+Math.floor(e/16).toString(16)+(e%16).toString(16)})+'"':'"'+a+'"'},number:function(a){return isFinite(a)?""+a:"null"},"boolean":function(a){return""+a},date:function(a){function b(a){return 10>a?"0"+a:a}return'"'+a.getFullYear()+"-"+b(a.getMonth()+1)+"-"+b(a.getDate())+"T"+b(a.getHours())+":"+b(a.getMinutes())+":"+b(a.getSeconds())+'"'}},CLASS_NAME:"OpenLayers.Format.JSON"});OpenLayers.Format.GeoJSON=OpenLayers.Class(OpenLayers.Format.JSON,{ignoreExtraDims:!1,read:function(a,b,c){var b=b?b:"FeatureCollection",d=null,e=null;if(e="string"==typeof a?OpenLayers.Format.JSON.prototype.read.apply(this,[a,c]):a)if("string"!=typeof e.type)OpenLayers.Console.error("Bad GeoJSON - no type: "+a);else{if(this.isValidType(e,b))switch(b){case"Geometry":try{d=this.parseGeometry(e)}catch(f){OpenLayers.Console.error(f)}break;case"Feature":try{d=this.parseFeature(e),d.type="Feature"}catch(g){OpenLayers.Console.error(g)}break;case"FeatureCollection":switch(d=[],e.type){case"Feature":try{d.push(this.parseFeature(e))}catch(h){d=null,OpenLayers.Console.error(h)}break;case"FeatureCollection":a=0;for(b=e.features.length;a<b;++a)try{d.push(this.parseFeature(e.features[a]))}catch(i){d=null,OpenLayers.Console.error(i)}break;default:try{var j=this.parseGeometry(e);d.push(new OpenLayers.Feature.Vector(j))}catch(k){d=null,OpenLayers.Console.error(k)}}}}else OpenLayers.Console.error("Bad JSON: "+a);return d},isValidType:function(a,b){var c=!1;switch(b){case"Geometry":-1==OpenLayers.Util.indexOf("Point MultiPoint LineString MultiLineString Polygon MultiPolygon Box GeometryCollection".split(" "),a.type)?OpenLayers.Console.error("Unsupported geometry type: "+a.type):c=!0;break;case"FeatureCollection":c=!0;break;default:a.type==b?c=!0:OpenLayers.Console.error("Cannot convert types from "+a.type+" to "+b)}return c},parseFeature:function(a){var b,c,d;c=a.properties?a.properties:{};d=a.geometry&&a.geometry.bbox||a.bbox;try{b=this.parseGeometry(a.geometry)}catch(e){throw e}b=new OpenLayers.Feature.Vector(b,c);d&&(b.bounds=OpenLayers.Bounds.fromArray(d));a.id&&(b.fid=a.id);return b},parseGeometry:function(a){if(null==a)return null;var b,c=!1;if("GeometryCollection"==a.type){if(!OpenLayers.Util.isArray(a.geometries))throw"GeometryCollection must have geometries array: "+a;b=a.geometries.length;for(var c=Array(b),d=0;d<b;++d)c[d]=this.parseGeometry.apply(this,[a.geometries[d]]);b=new OpenLayers.Geometry.Collection(c);c=!0}else{if(!OpenLayers.Util.isArray(a.coordinates))throw"Geometry must have coordinates array: "+a;if(!this.parseCoords[a.type.toLowerCase()])throw"Unsupported geometry type: "+a.type;try{b=this.parseCoords[a.type.toLowerCase()].apply(this,[a.coordinates])}catch(e){throw e}}this.internalProjection&&(this.externalProjection&&!c)&&b.transform(this.externalProjection,this.internalProjection);return b},parseCoords:{point:function(a){if(!1==this.ignoreExtraDims&&2!=a.length)throw"Only 2D points are supported: "+a;return new OpenLayers.Geometry.Point(a[0],a[1])},multipoint:function(a){for(var b=[],c=null,d=0,e=a.length;d<e;++d){try{c=this.parseCoords.point.apply(this,[a[d]])}catch(f){throw f}b.push(c)}return new OpenLayers.Geometry.MultiPoint(b)},linestring:function(a){for(var b=[],c=null,d=0,e=a.length;d<e;++d){try{c=this.parseCoords.point.apply(this,[a[d]])}catch(f){throw f}b.push(c)}return new OpenLayers.Geometry.LineString(b)},multilinestring:function(a){for(var b=[],c=null,d=0,e=a.length;d<e;++d){try{c=this.parseCoords.linestring.apply(this,[a[d]])}catch(f){throw f}b.push(c)}return new OpenLayers.Geometry.MultiLineString(b)},polygon:function(a){for(var b=[],c,d,e=0,f=a.length;e<f;++e){try{d=this.parseCoords.linestring.apply(this,[a[e]])}catch(g){throw g}c=new OpenLayers.Geometry.LinearRing(d.components);b.push(c)}return new OpenLayers.Geometry.Polygon(b)},multipolygon:function(a){for(var b=[],c=null,d=0,e=a.length;d<e;++d){try{c=this.parseCoords.polygon.apply(this,[a[d]])}catch(f){throw f}b.push(c)}return new OpenLayers.Geometry.MultiPolygon(b)},box:function(a){if(2!=a.length)throw"GeoJSON box coordinates must have 2 elements";return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(a[0][0],a[0][1]),new OpenLayers.Geometry.Point(a[1][0],a[0][1]),new OpenLayers.Geometry.Point(a[1][0],a[1][1]),new OpenLayers.Geometry.Point(a[0][0],a[1][1]),new OpenLayers.Geometry.Point(a[0][0],a[0][1])])])}},write:function(a,b){var c={type:null};if(OpenLayers.Util.isArray(a)){c.type="FeatureCollection";var d=a.length;c.features=Array(d);for(var e=0;e<d;++e){var f=a[e];if(!f instanceof OpenLayers.Feature.Vector)throw"FeatureCollection only supports collections of features: "+f;c.features[e]=this.extract.feature.apply(this,[f])}}else 0==a.CLASS_NAME.indexOf("OpenLayers.Geometry")?c=this.extract.geometry.apply(this,[a]):a instanceof OpenLayers.Feature.Vector&&(c=this.extract.feature.apply(this,[a]),a.layer&&a.layer.projection&&(c.crs=this.createCRSObject(a)));return OpenLayers.Format.JSON.prototype.write.apply(this,[c,b])},createCRSObject:function(a){var a=a.layer.projection.toString(),b={};a.match(/epsg:/i)&&(a=parseInt(a.substring(a.indexOf(":")+1)),b=4326==a?{type:"name",properties:{name:"urn:ogc:def:crs:OGC:1.3:CRS84"}}:{type:"name",properties:{name:"EPSG:"+a}});return b},extract:{feature:function(a){var b=this.extract.geometry.apply(this,[a.geometry]),b={type:"Feature",properties:a.attributes,geometry:b};null!=a.fid&&(b.id=a.fid);return b},geometry:function(a){if(null==a)return null;this.internalProjection&&this.externalProjection&&(a=a.clone(),a.transform(this.internalProjection,this.externalProjection));var b=a.CLASS_NAME.split(".")[2],a=this.extract[b.toLowerCase()].apply(this,[a]);return"Collection"==b?{type:"GeometryCollection",geometries:a}:{type:b,coordinates:a}},point:function(a){return[a.x,a.y]},multipoint:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extract.point.apply(this,[a.components[c]]));return b},linestring:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extract.point.apply(this,[a.components[c]]));return b},multilinestring:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extract.linestring.apply(this,[a.components[c]]));return b},polygon:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extract.linestring.apply(this,[a.components[c]]));return b},multipolygon:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extract.polygon.apply(this,[a.components[c]]));return b},collection:function(a){for(var b=a.components.length,c=Array(b),d=0;d<b;++d)c[d]=this.extract.geometry.apply(this,[a.components[d]]);return c}},CLASS_NAME:"OpenLayers.Format.GeoJSON"});OpenLayers.Protocol.Script=OpenLayers.Class(OpenLayers.Protocol,{url:null,params:null,callback:null,callbackTemplate:"OpenLayers.Protocol.Script.registry.${id}",callbackKey:"callback",callbackPrefix:"",scope:null,format:null,pendingRequests:null,srsInBBOX:!1,initialize:function(a){a=a||{};this.params={};this.pendingRequests={};OpenLayers.Protocol.prototype.initialize.apply(this,arguments);this.format||(this.format=new OpenLayers.Format.GeoJSON);if(!this.filterToParams&&OpenLayers.Format.QueryStringFilter){var b=new OpenLayers.Format.QueryStringFilter({srsInBBOX:this.srsInBBOX});this.filterToParams=function(a,d){return b.write(a,d)}}},read:function(a){OpenLayers.Protocol.prototype.read.apply(this,arguments);a=OpenLayers.Util.applyDefaults(a,this.options);a.params=OpenLayers.Util.applyDefaults(a.params,this.options.params);a.filter&&this.filterToParams&&(a.params=this.filterToParams(a.filter,a.params));var b=new OpenLayers.Protocol.Response({requestType:"read"}),c=this.createRequest(a.url,a.params,OpenLayers.Function.bind(function(c){b.data=c;this.handleRead(b,a)},this));b.priv=c;return b},createRequest:function(a,b,c){var c=OpenLayers.Protocol.Script.register(c),d=OpenLayers.String.format(this.callbackTemplate,{id:c}),b=OpenLayers.Util.extend({},b);b[this.callbackKey]=this.callbackPrefix+d;a=OpenLayers.Util.urlAppend(a,OpenLayers.Util.getParameterString(b));b=document.createElement("script");b.type="text/javascript";b.src=a;b.id="OpenLayers_Protocol_Script_"+c;this.pendingRequests[b.id]=b;document.getElementsByTagName("head")[0].appendChild(b);return b},destroyRequest:function(a){OpenLayers.Protocol.Script.unregister(a.id.split("_").pop());delete this.pendingRequests[a.id];a.parentNode&&a.parentNode.removeChild(a)},handleRead:function(a,b){this.handleResponse(a,b)},handleResponse:function(a,b){b.callback&&(a.data?(a.features=this.parseFeatures(a.data),a.code=OpenLayers.Protocol.Response.SUCCESS):a.code=OpenLayers.Protocol.Response.FAILURE,this.destroyRequest(a.priv),b.callback.call(b.scope,a))},parseFeatures:function(a){return this.format.read(a)},abort:function(a){if(a)this.destroyRequest(a.priv);else for(var b in this.pendingRequests)this.destroyRequest(this.pendingRequests[b])},destroy:function(){this.abort();delete this.params;delete this.format;OpenLayers.Protocol.prototype.destroy.apply(this)},CLASS_NAME:"OpenLayers.Protocol.Script"});(function(){var a=OpenLayers.Protocol.Script,b=0;a.registry={};a.register=function(c){var d="c"+ ++b;a.registry[d]=function(){c.apply(this,arguments)};return d};a.unregister=function(b){delete a.registry[b]}})();OpenLayers.Control.Panel=OpenLayers.Class(OpenLayers.Control,{controls:null,autoActivate:!0,defaultControl:null,saveState:!1,allowDepress:!1,activeState:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.controls=[];this.activeState={}},destroy:function(){this.map&&this.map.events.unregister("buttonclick",this,this.onButtonClick);OpenLayers.Control.prototype.destroy.apply(this,arguments);for(var a,b=this.controls.length-1;0<=b;b--)a=this.controls[b],a.events&&a.events.un({activate:this.iconOn,deactivate:this.iconOff}),a.panel_div=null;this.activeState=null},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){for(var a,b=0,c=this.controls.length;b<c;b++)a=this.controls[b],(a===this.defaultControl||this.saveState&&this.activeState[a.id])&&a.activate();!0===this.saveState&&(this.defaultControl=null);this.redraw();return!0}return!1},deactivate:function(){if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){for(var a,b=0,c=this.controls.length;b<c;b++)a=this.controls[b],this.activeState[a.id]=a.deactivate();this.redraw();return!0}return!1},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.outsideViewport?(this.events.attachToElement(this.div),this.events.register("buttonclick",this,this.onButtonClick)):this.map.events.register("buttonclick",this,this.onButtonClick);this.addControlsToMap(this.controls);return this.div},redraw:function(){for(var a=this.div.childNodes.length-1;0<=a;a--)this.div.removeChild(this.div.childNodes[a]);this.div.innerHTML="";if(this.active)for(var a=0,b=this.controls.length;a<b;a++)this.div.appendChild(this.controls[a].panel_div)},activateControl:function(a){if(!this.active)return!1;if(a.type==OpenLayers.Control.TYPE_BUTTON)a.trigger();else if(a.type==OpenLayers.Control.TYPE_TOGGLE)a.active?a.deactivate():a.activate();else if(this.allowDepress&&a.active)a.deactivate();else{for(var b,c=0,d=this.controls.length;c<d;c++)b=this.controls[c],b!=a&&(b.type===OpenLayers.Control.TYPE_TOOL||null==b.type)&&b.deactivate();a.activate()}},addControls:function(a){OpenLayers.Util.isArray(a)||(a=[a]);this.controls=this.controls.concat(a);for(var b=0,c=a.length;b<c;b++){var d=a[b],e=this.createControlMarkup(d);OpenLayers.Element.addClass(e,d.displayClass+"ItemInactive");OpenLayers.Element.addClass(e,"olButton");""!=d.title&&!e.title&&(e.title=d.title);d.panel_div=e}this.map&&(this.addControlsToMap(a),this.redraw())},createControlMarkup:function(){return document.createElement("div")},addControlsToMap:function(a){for(var b,c=0,d=a.length;c<d;c++)b=a[c],!0===b.autoActivate?(b.autoActivate=!1,this.map.addControl(b),b.autoActivate=!0):(this.map.addControl(b),b.deactivate()),b.events.on({activate:this.iconOn,deactivate:this.iconOff})},iconOn:function(){var a=this.panel_div;a.className=a.className.replace(RegExp("\\b("+this.displayClass+"Item)Inactive\\b"),"$1Active")},iconOff:function(){var a=this.panel_div;a.className=a.className.replace(RegExp("\\b("+this.displayClass+"Item)Active\\b"),"$1Inactive")},onButtonClick:function(a){for(var b=this.controls,a=a.buttonElement,c=b.length-1;0<=c;--c)if(b[c].panel_div===a){this.activateControl(b[c]);break}},getControlsBy:function(a,b){var c="function"==typeof b.test;return OpenLayers.Array.filter(this.controls,function(d){return d[a]==b||c&&b.test(d[a])})},getControlsByName:function(a){return this.getControlsBy("name",a)},getControlsByClass:function(a){return this.getControlsBy("CLASS_NAME",a)},CLASS_NAME:"OpenLayers.Control.Panel"});OpenLayers.Control.ZoomIn=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomIn()},CLASS_NAME:"OpenLayers.Control.ZoomIn"});OpenLayers.Control.ZoomOut=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomOut()},CLASS_NAME:"OpenLayers.Control.ZoomOut"});OpenLayers.Control.ZoomToMaxExtent=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map&&this.map.zoomToMaxExtent()},CLASS_NAME:"OpenLayers.Control.ZoomToMaxExtent"});OpenLayers.Control.ZoomPanel=OpenLayers.Class(OpenLayers.Control.Panel,{initialize:function(a){OpenLayers.Control.Panel.prototype.initialize.apply(this,[a]);this.addControls([new OpenLayers.Control.ZoomIn,new OpenLayers.Control.ZoomToMaxExtent,new OpenLayers.Control.ZoomOut])},CLASS_NAME:"OpenLayers.Control.ZoomPanel"});OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:!1,initialize:function(a,b,c,d){OpenLayers.Layer.prototype.initialize.apply(this,[a,d]);this.url=b;this.params||(this.params=OpenLayers.Util.extend({},c))},destroy:function(){this.params=this.url=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){null==a&&(a=new OpenLayers.Layer.HTTPRequest(this.name,this.url,this.params,this.getOptions()));return a=OpenLayers.Layer.prototype.clone.apply(this,[a])},setUrl:function(a){this.url=a},mergeNewParams:function(a){this.params=OpenLayers.Util.extend(this.params,a);a=this.redraw();null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"params"});return a},redraw:function(a){return a?this.mergeNewParams({_olSalt:Math.random()}):OpenLayers.Layer.prototype.redraw.apply(this,[])},selectUrl:function(a,b){for(var c=1,d=0,e=a.length;d<e;d++)c*=a.charCodeAt(d)*this.URL_HASH_FACTOR,c-=Math.floor(c);return b[Math.floor(c*b.length)]},getFullRequestString:function(a,b){var c=b||this.url,d=OpenLayers.Util.extend({},this.params),d=OpenLayers.Util.extend(d,a),e=OpenLayers.Util.getParameterString(d);OpenLayers.Util.isArray(c)&&(c=this.selectUrl(e,c));var e=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(c)),f;for(f in d)f.toUpperCase()in e&&delete d[f];e=OpenLayers.Util.getParameterString(d);return OpenLayers.Util.urlAppend(c,e)},CLASS_NAME:"OpenLayers.Layer.HTTPRequest"});OpenLayers.Tile=OpenLayers.Class({events:null,eventListeners:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:!1,initialize:function(a,b,c,d,e,f){this.layer=a;this.position=b.clone();this.setBounds(c);this.url=d;e&&(this.size=e.clone());this.id=OpenLayers.Util.createUniqueID("Tile_");OpenLayers.Util.extend(this,f);this.events=new OpenLayers.Events(this);if(this.eventListeners instanceof Object)this.events.on(this.eventListeners)},unload:function(){this.isLoading&&(this.isLoading=!1,this.events.triggerEvent("unload"))},destroy:function(){this.position=this.size=this.bounds=this.layer=null;this.eventListeners&&this.events.un(this.eventListeners);this.events.destroy();this.events=this.eventListeners=null},draw:function(a){a||this.clear();var b=this.shouldDraw();b&&!a&&(b=!1!==this.events.triggerEvent("beforedraw"));return b},shouldDraw:function(){var a=!1,b=this.layer.maxExtent;if(b){var c=this.layer.map,c=c.baseLayer.wrapDateLine&&c.getMaxExtent();this.bounds.intersectsBounds(b,{inclusive:!1,worldBounds:c})&&(a=!0)}return a||this.layer.displayOutsideMaxExtent},setBounds:function(a){a=a.clone();if(this.layer.map.baseLayer.wrapDateLine)var b=this.layer.map.getMaxExtent(),c=this.layer.map.getResolution(),a=a.wrapDateLine(b,{leftTolerance:c,rightTolerance:c});this.bounds=a},moveTo:function(a,b,c){null==c&&(c=!0);this.setBounds(a);this.position=b.clone();c&&this.draw()},clear:function(){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,imageReloadAttempts:null,layerAlphaHack:null,asyncRequestId:null,blankImageUrl:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAQAIBRAA7",maxGetUrlLength:null,canvasContext:null,crossOriginKeyword:null,initialize:function(a,b,c,d,e,f){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=d;this.layerAlphaHack=this.layer.alpha&&OpenLayers.Util.alphaHack();
if(null!=this.maxGetUrlLength||this.layer.gutter||this.layerAlphaHack)this.frame=document.createElement("div"),this.frame.style.position="absolute",this.frame.style.overflow="hidden";null!=this.maxGetUrlLength&&OpenLayers.Util.extend(this,OpenLayers.Tile.Image.IFrame)},destroy:function(){this.imgDiv&&(this.clear(),this.frame=this.imgDiv=null);this.asyncRequestId=null;OpenLayers.Tile.prototype.destroy.apply(this,arguments)},draw:function(){var a=OpenLayers.Tile.prototype.draw.apply(this,arguments);a?(this.layer!=this.layer.map.baseLayer&&this.layer.reproject&&(this.bounds=this.getBoundsFromBaseLayer(this.position)),this.isLoading?this._loadEvent="reload":(this.isLoading=!0,this._loadEvent="loadstart"),this.positionTile(),this.renderTile()):this.unload();return a},renderTile:function(){this.layer.div.appendChild(this.getTile());if(this.layer.async){var a=this.asyncRequestId=(this.asyncRequestId||0)+1;this.layer.getURLasync(this.bounds,function(b){a==this.asyncRequestId&&(this.url=b,this.initImage())},this)}else this.url=this.layer.getURL(this.bounds),this.initImage()},positionTile:function(){var a=this.getTile().style,b=this.frame?this.size:this.layer.getImageSize(this.bounds);a.left=this.position.x+"%";a.top=this.position.y+"%";a.width=b.w+"%";a.height=b.h+"%"},clear:function(){OpenLayers.Tile.prototype.clear.apply(this,arguments);var a=this.imgDiv;if(a){OpenLayers.Event.stopObservingElement(a);var b=this.getTile();b.parentNode===this.layer.div&&this.layer.div.removeChild(b);this.setImgSrc();!0===this.layerAlphaHack&&(a.style.filter="");OpenLayers.Element.removeClass(a,"olImageLoadError")}this.canvasContext=null},getImage:function(){if(!this.imgDiv){this.imgDiv=document.createElement("img");this.imgDiv.className="olTileImage";this.imgDiv.galleryImg="no";var a=this.imgDiv.style;if(this.frame){var b=0,c=0;this.layer.gutter&&(b=100*(this.layer.gutter/this.layer.tileSize.w),c=100*(this.layer.gutter/this.layer.tileSize.h));a.left=-b+"%";a.top=-c+"%";a.width=2*b+100+"%";a.height=2*c+100+"%"}a.visibility="hidden";a.opacity=0;1>this.layer.opacity&&(a.filter="alpha(opacity="+100*this.layer.opacity+")");a.position="absolute";this.layerAlphaHack&&(a.paddingTop=a.height,a.height="0",a.width="100%");this.frame&&this.frame.appendChild(this.imgDiv)}return this.imgDiv},initImage:function(){this.events.triggerEvent(this._loadEvent);var a=this.getImage();if(this.url&&a.getAttribute("src")==this.url)this.onImageLoad();else{var b=OpenLayers.Function.bind(function(){OpenLayers.Event.stopObservingElement(a);OpenLayers.Event.observe(a,"load",OpenLayers.Function.bind(this.onImageLoad,this));OpenLayers.Event.observe(a,"error",OpenLayers.Function.bind(this.onImageError,this));this.imageReloadAttempts=0;this.setImgSrc(this.url)},this);a.getAttribute("src")==this.blankImageUrl?b():(OpenLayers.Event.observe(a,"load",b),OpenLayers.Event.observe(a,"error",b),this.crossOriginKeyword&&a.removeAttribute("crossorigin"),a.src=this.blankImageUrl)}},setImgSrc:function(a){var b=this.imgDiv;b.style.visibility="hidden";b.style.opacity=0;a&&(this.crossOriginKeyword&&("data:"!==a.substr(0,5)?b.setAttribute("crossorigin",this.crossOriginKeyword):b.removeAttribute("crossorigin")),b.src=a)},getTile:function(){return this.frame?this.frame:this.getImage()},createBackBuffer:function(){if(this.imgDiv&&!this.isLoading){var a;this.frame?(a=this.frame.cloneNode(!1),a.appendChild(this.imgDiv)):a=this.imgDiv;this.imgDiv=null;return a}},onImageLoad:function(){var a=this.imgDiv;OpenLayers.Event.stopObservingElement(a);a.style.visibility="inherit";a.style.opacity=this.layer.opacity;this.isLoading=!1;this.canvasContext=null;this.events.triggerEvent("loadend");if(7>parseFloat(navigator.appVersion.split("MSIE")[1])&&this.layer&&this.layer.div){var b=document.createElement("span");b.style.display="none";var c=this.layer.div;c.appendChild(b);window.setTimeout(function(){b.parentNode===c&&b.parentNode.removeChild(b)},0)}!0===this.layerAlphaHack&&(a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a.src+"', sizingMethod='scale')")},onImageError:function(){var a=this.imgDiv;null!=a.src&&(this.imageReloadAttempts++,this.imageReloadAttempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS?this.setImgSrc(this.layer.getURL(this.bounds)):(OpenLayers.Element.addClass(a,"olImageLoadError"),this.events.triggerEvent("loaderror"),this.onImageLoad()))},getCanvasContext:function(){if(OpenLayers.CANVAS_SUPPORTED&&this.imgDiv&&!this.isLoading){if(!this.canvasContext){var a=document.createElement("canvas");a.width=this.size.w;a.height=this.size.h;this.canvasContext=a.getContext("2d");this.canvasContext.drawImage(this.imgDiv,0,0)}return this.canvasContext}},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Layer.Grid=OpenLayers.Class(OpenLayers.Layer.HTTPRequest,{tileSize:null,tileOriginCorner:"bl",tileOrigin:null,tileOptions:null,tileClass:OpenLayers.Tile.Image,grid:null,singleTile:!1,ratio:1.5,buffer:0,transitionEffect:null,numLoadingTiles:0,tileLoadingDelay:85,serverResolutions:null,moveTimerId:null,deferMoveGriddedTiles:null,tileQueueId:null,tileQueue:null,loading:!1,backBuffer:null,gridResolution:null,backBufferResolution:null,backBufferLonLat:null,backBufferTimerId:null,removeBackBufferDelay:null,className:null,initialize:function(a,b,c,d){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.grid=[];this.tileQueue=[];null===this.removeBackBufferDelay&&(this.removeBackBufferDelay=this.singleTile?0:2500);null===this.className&&(this.className=this.singleTile?"olLayerGridSingleTile":"olLayerGrid");OpenLayers.Animation.isNative||(this.deferMoveGriddedTiles=OpenLayers.Function.bind(function(){this.moveGriddedTiles(true);this.moveTimerId=null},this))},setMap:function(a){OpenLayers.Layer.HTTPRequest.prototype.setMap.call(this,a);OpenLayers.Element.addClass(this.div,this.className)},removeMap:function(){null!==this.moveTimerId&&(window.clearTimeout(this.moveTimerId),this.moveTimerId=null);this.clearTileQueue();null!==this.backBufferTimerId&&(window.clearTimeout(this.backBufferTimerId),this.backBufferTimerId=null)},destroy:function(){this.removeBackBuffer();this.clearGrid();this.tileSize=this.grid=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments)},clearGrid:function(){this.clearTileQueue();if(this.grid){for(var a=0,b=this.grid.length;a<b;a++)for(var c=this.grid[a],d=0,e=c.length;d<e;d++)this.destroyTile(c[d]);this.grid=[];this.gridResolution=null}},clone:function(a){null==a&&(a=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.getOptions()));a=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[a]);null!=this.tileSize&&(a.tileSize=this.tileSize.clone());a.grid=[];a.gridResolution=null;a.backBuffer=null;a.backBufferTimerId=null;a.tileQueue=[];a.tileQueueId=null;a.loading=!1;a.moveTimerId=null;return a},moveTo:function(a,b,c){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);a=a||this.map.getExtent();if(null!=a){var d=!this.grid.length||b,e=this.getTilesBounds(),f=this.map.getResolution(),g=this.getServerResolution(f);if(this.singleTile){if(d||!c&&!e.containsBounds(a))b&&"resize"!==this.transitionEffect&&this.removeBackBuffer(),(!b||"resize"===this.transitionEffect)&&this.applyBackBuffer(g),this.initSingleTile(a)}else(d=d||!e.intersectsBounds(a,{worldBounds:this.map.baseLayer.wrapDateLine&&this.map.getMaxExtent()}),f!==g?(a=this.map.calculateBounds(null,g),d&&this.transformDiv(g/f)):(this.div.style.width="100%",this.div.style.height="100%",this.div.style.left="0%",this.div.style.top="0%"),d)?(b&&"resize"===this.transitionEffect&&this.applyBackBuffer(g),this.initGriddedTiles(a)):this.moveGriddedTiles()}},getTileData:function(a){var b=null,c=a.lon,d=a.lat,e=this.grid.length;if(this.map&&e){var f=this.map.getResolution(),a=this.tileSize.w,g=this.tileSize.h,h=this.grid[0][0].bounds,i=h.left,h=h.top;if(c<i&&this.map.baseLayer.wrapDateLine)var j=this.map.getMaxExtent().getWidth(),k=Math.ceil((i-c)/j),c=c+j*k;c=(c-i)/(f*a);d=(h-d)/(f*g);f=Math.floor(c);i=Math.floor(d);0<=i&&i<e&&(e=this.grid[i][f])&&(b={tile:e,i:Math.floor((c-f)*a),j:Math.floor((d-i)*g)})}return b},queueTileDraw:function(a){a=a.object;~OpenLayers.Util.indexOf(this.tileQueue,a)||this.tileQueue.push(a);this.tileQueueId||(this.tileQueueId=OpenLayers.Animation.start(OpenLayers.Function.bind(this.drawTileFromQueue,this),null,this.div));return!1},drawTileFromQueue:function(){0===this.tileQueue.length?this.clearTileQueue():this.tileQueue.shift().draw(!0)},clearTileQueue:function(){OpenLayers.Animation.stop(this.tileQueueId);this.tileQueueId=null;this.tileQueue=[]},destroyTile:function(a){this.removeTileMonitoringHooks(a);a.destroy()},getServerResolution:function(a){a=a||this.map.getResolution();if(this.serverResolutions&&-1===OpenLayers.Util.indexOf(this.serverResolutions,a)){var b,c;for(b=this.serverResolutions.length-1;0<=b;b--)if(c=this.serverResolutions[b],c>a){a=c;break}if(-1===b)throw"no appropriate resolution in serverResolutions"}return a},getServerZoom:function(){var a=this.getServerResolution();return this.serverResolutions?OpenLayers.Util.indexOf(this.serverResolutions,a):this.map.getZoomForResolution(a)+(this.zoomOffset||0)},transformDiv:function(a){this.div.style.width=100*a+"%";this.div.style.height=100*a+"%";var b=this.map.getSize(),c=parseInt(this.map.layerContainerDiv.style.left,10),d=(parseInt(this.map.layerContainerDiv.style.top,10)-b.h/2)*(a-1);this.div.style.left=(c-b.w/2)*(a-1)+"%";this.div.style.top=d+"%"},getResolutionScale:function(){return parseInt(this.div.style.width,10)/100},applyBackBuffer:function(a){null!==this.backBufferTimerId&&this.removeBackBuffer();var b=this.backBuffer;if(!b){b=this.createBackBuffer();if(!b)return;this.div.insertBefore(b,this.div.firstChild);this.backBuffer=b;var c=this.grid[0][0].bounds;this.backBufferLonLat={lon:c.left,lat:c.top};this.backBufferResolution=this.gridResolution}var c=b.style,d=this.backBufferResolution/a;c.width=100*d+"%";c.height=100*d+"%";a=this.getViewPortPxFromLonLat(this.backBufferLonLat,a);c=parseInt(this.map.layerContainerDiv.style.left,10);d=parseInt(this.map.layerContainerDiv.style.top,10);b.style.left=Math.round(a.x-c)+"%";b.style.top=Math.round(a.y-d)+"%"},createBackBuffer:function(){var a;if(0<this.grid.length){a=document.createElement("div");a.id=this.div.id+"_bb";a.className="olBackBuffer";a.style.position="absolute";a.style.width="100%";a.style.height="100%";for(var b=0,c=this.grid.length;b<c;b++)for(var d=0,e=this.grid[b].length;d<e;d++){var f=this.grid[b][d].createBackBuffer();f&&(f.style.top=b*this.tileSize.h+"%",f.style.left=d*this.tileSize.w+"%",a.appendChild(f))}}return a},removeBackBuffer:function(){this.backBuffer&&(this.div.removeChild(this.backBuffer),this.backBufferResolution=this.backBuffer=null,null!==this.backBufferTimerId&&(window.clearTimeout(this.backBufferTimerId),this.backBufferTimerId=null))},moveByPx:function(){this.singleTile||this.moveGriddedTiles()},setTileSize:function(a){this.singleTile&&(a=this.map.getSize(),a.h=parseInt(a.h*this.ratio),a.w=parseInt(a.w*this.ratio));OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this,[a])},getTilesBounds:function(){var a=null,b=this.grid.length;if(b)var a=this.grid[b-1][0].bounds,b=this.grid[0].length*a.getWidth(),c=this.grid.length*a.getHeight(),a=new OpenLayers.Bounds(a.left,a.bottom,a.left+b,a.bottom+c);return a},initSingleTile:function(a){this.clearTileQueue();var b=a.getCenterLonLat(),c=a.getWidth()*this.ratio,a=a.getHeight()*this.ratio,b=new OpenLayers.Bounds(b.lon-c/2,b.lat-a/2,b.lon+c/2,b.lat+a/2),c=this.map.getLayerPxFromLonLat({lon:b.left,lat:b.top});this.grid.length||(this.grid[0]=[]);(a=this.grid[0][0])?a.moveTo(b,c):(a=this.addTile(b,c),this.addTileMonitoringHooks(a),a.draw(),this.grid[0][0]=a);this.removeExcessTiles(1,1);this.gridResolution=this.getServerResolution()},calculateGridLayout:function(a,b,c){var d=c*this.tileSize.w,c=c*this.tileSize.h,e=a.left-b.lon,f=Math.floor(e/d)-this.buffer,e=-(e/d-f)*this.tileSize.w,f=b.lon+f*d,a=a.top-(b.lat+c),g=Math.ceil(a/c)+this.buffer;return{tilelon:d,tilelat:c,tileoffsetlon:f,tileoffsetlat:b.lat+g*c,tileoffsetx:e,tileoffsety:-(g-a/c)*this.tileSize.h}},getTileOrigin:function(){var a=this.tileOrigin;if(!a)var a=this.getMaxExtent(),b={tl:["left","top"],tr:["right","top"],bl:["left","bottom"],br:["right","bottom"]}[this.tileOriginCorner],a=new OpenLayers.LonLat(a[b[0]],a[b[1]]);return a},initGriddedTiles:function(a){this.clearTileQueue();var b=this.map.getSize(),c=Math.ceil(b.h/this.tileSize.h)+Math.max(1,2*this.buffer),b=Math.ceil(b.w/this.tileSize.w)+Math.max(1,2*this.buffer),d=this.getTileOrigin(),e=this.getServerResolution(),d=this.calculateGridLayout(a,d,e),e=Math.round(d.tileoffsetx),f=Math.round(d.tileoffsety),g=d.tileoffsetlon,h=d.tileoffsetlat,i=d.tilelon,j=d.tilelat,k=e,l=g,m=0,n=parseInt(this.map.layerContainerDiv.style.left),o=parseInt(this.map.layerContainerDiv.style.top),d=[],p=this.map.getCenter();do{var q=this.grid[m++];q||(q=[],this.grid.push(q));var g=l,e=k,r=0;do{var s=new OpenLayers.Bounds(g,h,g+i,h+j),t=e,t=t-n,u=f,u=u-o,u=new OpenLayers.Pixel(t,u);(t=q[r++])?t.moveTo(s,u,!1):(t=this.addTile(s,u),this.addTileMonitoringHooks(t),q.push(t));s=s.getCenterLonLat();d.push({tile:t,distance:Math.pow(s.lon-p.lon,2)+Math.pow(s.lat-p.lat,2)});g+=i;e+=this.tileSize.w}while(g<=a.right+i*this.buffer||r<b);h-=j;f+=this.tileSize.h}while(h>=a.bottom-j*this.buffer||m<c);this.removeExcessTiles(m,r);this.gridResolution=this.getServerResolution();d.sort(function(a,b){return a.distance-b.distance});a=0;for(c=d.length;a<c;++a)d[a].tile.draw()},getMaxExtent:function(){return this.maxExtent},addTile:function(a,b){var c=new this.tileClass(this,b,a,null,this.tileSize,this.tileOptions);c.events.register("beforedraw",this,this.queueTileDraw);return c},addTileMonitoringHooks:function(a){a.onLoadStart=function(){!1===this.loading&&(this.loading=!0,this.events.triggerEvent("loadstart"));this.events.triggerEvent("tileloadstart",{tile:a});this.numLoadingTiles++};a.onLoadEnd=function(){this.numLoadingTiles--;this.events.triggerEvent("tileloaded",{tile:a});0===this.tileQueue.length&&0===this.numLoadingTiles&&(this.loading=!1,this.events.triggerEvent("loadend"),this.backBuffer&&(this.backBufferTimerId=window.setTimeout(OpenLayers.Function.bind(this.removeBackBuffer,this),this.removeBackBufferDelay)))};a.onLoadError=function(){this.events.triggerEvent("tileerror",{tile:a})};a.events.on({loadstart:a.onLoadStart,loadend:a.onLoadEnd,unload:a.onLoadEnd,loaderror:a.onLoadError,scope:this})},removeTileMonitoringHooks:function(a){a.unload();a.events.un({loadstart:a.onLoadStart,loadend:a.onLoadEnd,unload:a.onLoadEnd,loaderror:a.onLoadError,scope:this})},moveGriddedTiles:function(a){if(!a&&!OpenLayers.Animation.isNative)null!=this.moveTimerId&&window.clearTimeout(this.moveTimerId),this.moveTimerId=window.setTimeout(this.deferMoveGriddedTiles,this.tileLoadingDelay);else for(var a=this.buffer||1,b=this.getResolutionScale();;){var c=this.grid[0][0].position.x*b+parseInt(this.div.style.left,10)+parseInt(this.map.layerContainerDiv.style.left),d=this.grid[0][0].position.y*b+parseInt(this.div.style.top,10)+parseInt(this.map.layerContainerDiv.style.top),e=this.tileSize.w*b,f=this.tileSize.h*b;if(c>-e*(a-1))this.shiftColumn(!0);else if(c<-e*a)this.shiftColumn(!1);else if(d>-f*(a-1))this.shiftRow(!0);else if(d<-f*a)this.shiftRow(!1);else break}},shiftRow:function(a){for(var b=this.grid,c=b[a?0:this.grid.length-1],d=this.getServerResolution(),e=a?-this.tileSize.h:this.tileSize.h,d=d*-e,f=a?b.pop():b.shift(),g=0,h=c.length;g<h;g++){var i=c[g],j=i.bounds.clone(),i=i.position.clone();j.bottom+=d;j.top+=d;i.y+=e;f[g].moveTo(j,i)}a?b.unshift(f):b.push(f)},shiftColumn:function(a){for(var b=a?-this.tileSize.w:this.tileSize.w,c=this.getServerResolution()*b,d=0,e=this.grid.length;d<e;d++){var f=this.grid[d],g=f[a?0:f.length-1],h=g.bounds.clone(),g=g.position.clone();h.left+=c;h.right+=c;g.x+=b;var i=a?this.grid[d].pop():this.grid[d].shift();i.moveTo(h,g);a?f.unshift(i):f.push(i)}},removeExcessTiles:function(a,b){for(var c,d;this.grid.length>a;){var e=this.grid.pop();c=0;for(d=e.length;c<d;c++){var f=e[c];this.destroyTile(f)}}c=0;for(d=this.grid.length;c<d;c++)for(;this.grid[c].length>b;)e=this.grid[c],f=e.pop(),this.destroyTile(f)},onMapResize:function(){this.singleTile&&(this.clearGrid(),this.setTileSize())},getTileBounds:function(a){var b=this.maxExtent,c=this.getResolution(),d=c*this.tileSize.w,c=c*this.tileSize.h,e=this.getLonLatFromViewPortPx(a),a=b.left+d*Math.floor((e.lon-b.left)/d),b=b.bottom+c*Math.floor((e.lat-b.bottom)/c);return new OpenLayers.Bounds(a,b,a+d,b+c)},CLASS_NAME:"OpenLayers.Layer.Grid"});OpenLayers.Format.ArcXML=OpenLayers.Class(OpenLayers.Format.XML,{fontStyleKeys:"antialiasing blockout font fontcolor fontsize fontstyle glowing interval outline printmode shadow transparency".split(" "),request:null,response:null,initialize:function(a){this.request=new OpenLayers.Format.ArcXML.Request;this.response=new OpenLayers.Format.ArcXML.Response;if(a)if("feature"==a.requesttype){this.request.get_image=null;var b=this.request.get_feature.query;this.addCoordSys(b.featurecoordsys,a.featureCoordSys);this.addCoordSys(b.filtercoordsys,a.filterCoordSys);a.polygon?(b.isspatial=!0,b.spatialfilter.polygon=a.polygon):a.envelope&&(b.isspatial=!0,b.spatialfilter.envelope={minx:0,miny:0,maxx:0,maxy:0},this.parseEnvelope(b.spatialfilter.envelope,a.envelope))}else"image"==a.requesttype?(this.request.get_feature=null,b=this.request.get_image.properties,this.parseEnvelope(b.envelope,a.envelope),this.addLayers(b.layerlist,a.layers),this.addImageSize(b.imagesize,a.tileSize),this.addCoordSys(b.featurecoordsys,a.featureCoordSys),this.addCoordSys(b.filtercoordsys,a.filterCoordSys)):this.request=null;OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},parseEnvelope:function(a,b){b&&4==b.length&&(a.minx=b[0],a.miny=b[1],a.maxx=b[2],a.maxy=b[3])},addLayers:function(a,b){for(var c=0,d=b.length;c<d;c++)a.push(b[c])},addImageSize:function(a,b){null!==b&&(a.width=b.w,a.height=b.h,a.printwidth=b.w,a.printheight=b.h)},addCoordSys:function(a,b){"string"==typeof b?(a.id=parseInt(b),a.string=b):"object"==typeof b&&null!==b.proj&&(a.id=b.proj.srsProjNumber,a.string=b.proj.srsCode)},iserror:function(a){var b=null;a?(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]),a=a.documentElement.getElementsByTagName("ERROR"),b=null!==a&&0<a.length):b=""!==this.response.error;return b},read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));var b=null;a&&a.documentElement&&(b="ARCXML"==a.documentElement.nodeName?a.documentElement:a.documentElement.getElementsByTagName("ARCXML")[0]);if(!b||"parsererror"===b.firstChild.nodeName){var c,d;try{c=a.firstChild.nodeValue,d=a.firstChild.childNodes[1].firstChild.nodeValue}catch(e){}throw{message:"Error parsing the ArcXML request",error:c,source:d}}return this.parseResponse(b)},write:function(a){a||(a=this.request);var b=this.createElementNS("","ARCXML");b.setAttribute("version","1.1");var c=this.createElementNS("","REQUEST");if(null!=a.get_image){var d=this.createElementNS("","GET_IMAGE");c.appendChild(d);var e=this.createElementNS("","PROPERTIES");d.appendChild(e);a=a.get_image.properties;null!=a.featurecoordsys&&(d=this.createElementNS("","FEATURECOORDSYS"),e.appendChild(d),0===a.featurecoordsys.id?d.setAttribute("string",a.featurecoordsys.string):d.setAttribute("id",a.featurecoordsys.id));null!=a.filtercoordsys&&(d=this.createElementNS("","FILTERCOORDSYS"),e.appendChild(d),0===a.filtercoordsys.id?d.setAttribute("string",a.filtercoordsys.string):d.setAttribute("id",a.filtercoordsys.id));null!=a.envelope&&(d=this.createElementNS("","ENVELOPE"),e.appendChild(d),d.setAttribute("minx",a.envelope.minx),d.setAttribute("miny",a.envelope.miny),d.setAttribute("maxx",a.envelope.maxx),d.setAttribute("maxy",a.envelope.maxy));d=this.createElementNS("","IMAGESIZE");e.appendChild(d);d.setAttribute("height",a.imagesize.height);d.setAttribute("width",a.imagesize.width);if(a.imagesize.height!=a.imagesize.printheight||a.imagesize.width!=a.imagesize.printwidth)d.setAttribute("printheight",a.imagesize.printheight),d.setAttribute("printwidth",a.imagesize.printwidth);null!=a.background&&(d=this.createElementNS("","BACKGROUND"),e.appendChild(d),d.setAttribute("color",a.background.color.r+","+a.background.color.g+","+a.background.color.b),null!==a.background.transcolor&&d.setAttribute("transcolor",a.background.transcolor.r+","+a.background.transcolor.g+","+a.background.transcolor.b));if(null!=a.layerlist&&0<a.layerlist.length){d=this.createElementNS("","LAYERLIST");e.appendChild(d);for(e=0;e<a.layerlist.length;e++){var f=this.createElementNS("","LAYERDEF");d.appendChild(f);f.setAttribute("id",a.layerlist[e].id);f.setAttribute("visible",a.layerlist[e].visible);if("object"==typeof a.layerlist[e].query){var g=a.layerlist[e].query;if(0>g.where.length)continue;var h=null,h="boolean"==typeof g.spatialfilter&&g.spatialfilter?this.createElementNS("","SPATIALQUERY"):this.createElementNS("","QUERY");h.setAttribute("where",g.where);"number"==typeof g.accuracy&&0<g.accuracy&&h.setAttribute("accuracy",g.accuracy);"number"==typeof g.featurelimit&&2e3>g.featurelimit&&h.setAttribute("featurelimit",g.featurelimit);"string"==typeof g.subfields&&"#ALL#"!=g.subfields&&h.setAttribute("subfields",g.subfields);"string"==typeof g.joinexpression&&0<g.joinexpression.length&&h.setAttribute("joinexpression",g.joinexpression);"string"==typeof g.jointables&&0<g.jointables.length&&h.setAttribute("jointables",g.jointables);f.appendChild(h)}"object"==typeof a.layerlist[e].renderer&&this.addRenderer(f,a.layerlist[e].renderer)}}}else if(null!=a.get_feature&&(d=this.createElementNS("","GET_FEATURES"),d.setAttribute("outputmode","newxml"),d.setAttribute("checkesc","true"),a.get_feature.geometry?d.setAttribute("geometry",a.get_feature.geometry):d.setAttribute("geometry","false"),a.get_feature.compact&&d.setAttribute("compact",a.get_feature.compact),"number"==a.get_feature.featurelimit&&d.setAttribute("featurelimit",a.get_feature.featurelimit),d.setAttribute("globalenvelope","true"),c.appendChild(d),null!=a.get_feature.layer&&0<a.get_feature.layer.length&&(e=this.createElementNS("","LAYER"),e.setAttribute("id",a.get_feature.layer),d.appendChild(e)),a=a.get_feature.query,null!=a))e=null,e=a.isspatial?this.createElementNS("","SPATIALQUERY"):this.createElementNS("","QUERY"),d.appendChild(e),"number"==typeof a.accuracy&&e.setAttribute("accuracy",a.accuracy),null!=a.featurecoordsys&&(d=this.createElementNS("","FEATURECOORDSYS"),0==a.featurecoordsys.id?d.setAttribute("string",a.featurecoordsys.string):d.setAttribute("id",a.featurecoordsys.id),e.appendChild(d)),null!=a.filtercoordsys&&(d=this.createElementNS("","FILTERCOORDSYS"),0===a.filtercoordsys.id?d.setAttribute("string",a.filtercoordsys.string):d.setAttribute("id",a.filtercoordsys.id),e.appendChild(d)),0<a.buffer&&(d=this.createElementNS("","BUFFER"),d.setAttribute("distance",a.buffer),e.appendChild(d)),a.isspatial&&(d=this.createElementNS("","SPATIALFILTER"),d.setAttribute("relation",a.spatialfilter.relation),e.appendChild(d),a.spatialfilter.envelope?(f=this.createElementNS("","ENVELOPE"),f.setAttribute("minx",a.spatialfilter.envelope.minx),f.setAttribute("miny",a.spatialfilter.envelope.miny),f.setAttribute("maxx",a.spatialfilter.envelope.maxx),f.setAttribute("maxy",a.spatialfilter.envelope.maxy),d.appendChild(f)):"object"==typeof a.spatialfilter.polygon&&d.appendChild(this.writePolygonGeometry(a.spatialfilter.polygon))),null!=a.where&&0<a.where.length&&e.setAttribute("where",a.where);b.appendChild(c);return OpenLayers.Format.XML.prototype.write.apply(this,[b])},addGroupRenderer:function(a,b){var c=this.createElementNS("","GROUPRENDERER");a.appendChild(c);for(var d=0;d<b.length;d++)this.addRenderer(c,b[d])},addRenderer:function(a,b){if(OpenLayers.Util.isArray(b))this.addGroupRenderer(a,b);else{var c=this.createElementNS("",b.type.toUpperCase()+"RENDERER");a.appendChild(c);"VALUEMAPRENDERER"==c.tagName?this.addValueMapRenderer(c,b):"VALUEMAPLABELRENDERER"==c.tagName?this.addValueMapLabelRenderer(c,b):"SIMPLELABELRENDERER"==c.tagName?this.addSimpleLabelRenderer(c,b):"SCALEDEPENDENTRENDERER"==c.tagName&&this.addScaleDependentRenderer(c,b)}},addScaleDependentRenderer:function(a,b){("string"==typeof b.lower||"number"==typeof b.lower)&&a.setAttribute("lower",b.lower);("string"==typeof b.upper||"number"==typeof b.upper)&&a.setAttribute("upper",b.upper);this.addRenderer(a,b.renderer)},addValueMapLabelRenderer:function(a,b){a.setAttribute("lookupfield",b.lookupfield);a.setAttribute("labelfield",b.labelfield);if("object"==typeof b.exacts)for(var c=0,d=b.exacts.length;c<d;c++){var e=b.exacts[c],f=this.createElementNS("","EXACT");"string"==typeof e.value&&f.setAttribute("value",e.value);"string"==typeof e.label&&f.setAttribute("label",e.label);"string"==typeof e.method&&f.setAttribute("method",e.method);a.appendChild(f);if("object"==typeof e.symbol){var g=null;"text"==e.symbol.type&&(g=this.createElementNS("","TEXTSYMBOL"));if(null!=g){for(var h=this.fontStyleKeys,i=0,j=h.length;i<j;i++){var k=h[i];e.symbol[k]&&g.setAttribute(k,e.symbol[k])}f.appendChild(g)}}}},addValueMapRenderer:function(a,b){a.setAttribute("lookupfield",b.lookupfield);if("object"==typeof b.ranges)for(var c=0,d=b.ranges.length;c<d;c++){var e=b.ranges[c],f=this.createElementNS("","RANGE");f.setAttribute("lower",e.lower);f.setAttribute("upper",e.upper);a.appendChild(f);if("object"==typeof e.symbol){var g=null;"simplepolygon"==e.symbol.type&&(g=this.createElementNS("","SIMPLEPOLYGONSYMBOL"));null!=g&&("string"==typeof e.symbol.boundarycolor&&g.setAttribute("boundarycolor",e.symbol.boundarycolor),"string"==typeof e.symbol.fillcolor&&g.setAttribute("fillcolor",e.symbol.fillcolor),"number"==typeof e.symbol.filltransparency&&g.setAttribute("filltransparency",e.symbol.filltransparency),f.appendChild(g))}}else if("object"==typeof b.exacts){c=0;for(d=b.exacts.length;c<d;c++)e=b.exacts[c],f=this.createElementNS("","EXACT"),"string"==typeof e.value&&f.setAttribute("value",e.value),"string"==typeof e.label&&f.setAttribute("label",e.label),"string"==typeof e.method&&f.setAttribute("method",e.method),a.appendChild(f),"object"==typeof e.symbol&&(g=null,"simplemarker"==e.symbol.type&&(g=this.createElementNS("","SIMPLEMARKERSYMBOL")),null!=g&&("string"==typeof e.symbol.antialiasing&&g.setAttribute("antialiasing",e.symbol.antialiasing),"string"==typeof e.symbol.color&&g.setAttribute("color",e.symbol.color),"string"==typeof e.symbol.outline&&g.setAttribute("outline",e.symbol.outline),"string"==typeof e.symbol.overlap&&g.setAttribute("overlap",e.symbol.overlap),"string"==typeof e.symbol.shadow&&g.setAttribute("shadow",e.symbol.shadow),"number"==typeof e.symbol.transparency&&g.setAttribute("transparency",e.symbol.transparency),"string"==typeof e.symbol.usecentroid&&g.setAttribute("usecentroid",e.symbol.usecentroid),"number"==typeof e.symbol.width&&g.setAttribute("width",e.symbol.width),f.appendChild(g)))}},addSimpleLabelRenderer:function(a,b){a.setAttribute("field",b.field);for(var c="featureweight howmanylabels labelbufferratio labelpriorities labelweight linelabelposition rotationalangles".split(" "),d=0,e=c.length;d<e;d++){var f=c[d];b[f]&&a.setAttribute(f,b[f])}if("text"==b.symbol.type){var g=b.symbol,h=this.createElementNS("","TEXTSYMBOL");a.appendChild(h);c=this.fontStyleKeys;d=0;for(e=c.length;d<e;d++)f=c[d],g[f]&&h.setAttribute(f,b[f])}},writePolygonGeometry:function(a){if(!(a instanceof OpenLayers.Geometry.Polygon))throw{message:"Cannot write polygon geometry to ArcXML with an "+a.CLASS_NAME+" object.",geometry:a};for(var b=this.createElementNS("","POLYGON"),c=0,d=a.components.length;c<d;c++){for(var e=a.components[c],f=this.createElementNS("","RING"),g=0,h=e.components.length;g<h;g++){var i=e.components[g],j=this.createElementNS("","POINT");j.setAttribute("x",i.x);j.setAttribute("y",i.y);f.appendChild(j)}b.appendChild(f)}return b},parseResponse:function(a){"string"==typeof a&&(a=(new OpenLayers.Format.XML).read(a));var b=new OpenLayers.Format.ArcXML.Response,c=a.getElementsByTagName("ERROR");if(null!=c&&0<c.length)b.error=this.getChildValue(c,"Unknown error.");else{c=a.getElementsByTagName("RESPONSE");if(null==c||0==c.length)return b.error="No RESPONSE tag found in ArcXML response.",b;var d=c[0].firstChild.nodeName;"#text"==d&&(d=c[0].firstChild.nextSibling.nodeName);if("IMAGE"==d)c=a.getElementsByTagName("ENVELOPE"),a=a.getElementsByTagName("OUTPUT"),null==c||0==c.length?b.error="No ENVELOPE tag found in ArcXML response.":null==a||0==a.length?b.error="No OUTPUT tag found in ArcXML response.":(c=this.parseAttributes(c[0]),d=this.parseAttributes(a[0]),b.image="string"==typeof d.type?{envelope:c,output:{type:d.type,data:this.getChildValue(a[0])}}:{envelope:c,output:d});else if("FEATURES"==d){if(a=c[0].getElementsByTagName("FEATURES"),c=a[0].getElementsByTagName("FEATURECOUNT"),b.features.featurecount=c[0].getAttribute("count"),0<b.features.featurecount){c=a[0].getElementsByTagName("ENVELOPE");b.features.envelope=this.parseAttributes(c[0],"number");a=a[0].getElementsByTagName("FEATURE");for(c=0;c<a.length;c++){for(var d=new OpenLayers.Feature.Vector,e=a[c].getElementsByTagName("FIELD"),f=0;f<e.length;f++){var g=e[f].getAttribute("name"),h=e[f].getAttribute("value");d.attributes[g]=h}e=a[c].getElementsByTagName("POLYGON");if(0<e.length){e=e[0].getElementsByTagName("RING");f=[];for(g=0;g<e.length;g++){h=[];h.push(this.parsePointGeometry(e[g]));for(var i=e[g].getElementsByTagName("HOLE"),j=0;j<i.length;j++)h.push(this.parsePointGeometry(i[j]));f.push(new OpenLayers.Geometry.Polygon(h))}d.geometry=1==f.length?f[0]:new OpenLayers.Geometry.MultiPolygon(f)}b.features.feature.push(d)}}}else b.error="Unidentified response type."}return b},parseAttributes:function(a,b){for(var c={},d=0;d<a.attributes.length;d++)c[a.attributes[d].nodeName]="number"==b?parseFloat(a.attributes[d].nodeValue):a.attributes[d].nodeValue;return c},parsePointGeometry:function(a){var b=[],c=a.getElementsByTagName("COORDS");if(0<c.length){a=this.getChildValue(c[0]);a=a.split(/;/);for(c=0;c<a.length;c++){var d=a[c].split(/ /);b.push(new OpenLayers.Geometry.Point(d[0],d[1]))}}else if(a=a.getElementsByTagName("POINT"),0<a.length)for(c=0;c<a.length;c++)b.push(new OpenLayers.Geometry.Point(parseFloat(a[c].getAttribute("x")),parseFloat(a[c].getAttribute("y"))));return new OpenLayers.Geometry.LinearRing(b)},CLASS_NAME:"OpenLayers.Format.ArcXML"});OpenLayers.Format.ArcXML.Request=OpenLayers.Class({initialize:function(){return OpenLayers.Util.extend(this,{get_image:{properties:{background:null,draw:!0,envelope:{minx:0,miny:0,maxx:0,maxy:0},featurecoordsys:{id:0,string:"",datumtransformid:0,datumtransformstring:""},filtercoordsys:{id:0,string:"",datumtransformid:0,datumtransformstring:""},imagesize:{height:0,width:0,dpi:96,printheight:0,printwidth:0,scalesymbols:!1},layerlist:[],output:{baseurl:"",legendbaseurl:"",legendname:"",legendpath:"",legendurl:"",name:"",path:"",type:"jpg",url:""}}},get_feature:{layer:"",query:{isspatial:!1,featurecoordsys:{id:0,string:"",datumtransformid:0,datumtransformstring:""},filtercoordsys:{id:0,string:"",datumtransformid:0,datumtransformstring:""},buffer:0,where:"",spatialfilter:{relation:"envelope_intersection",envelope:null}}},environment:{separators:{cs:" ",ts:";"}},layer:[],workspaces:[]})},CLASS_NAME:"OpenLayers.Format.ArcXML.Request"});OpenLayers.Format.ArcXML.Response=OpenLayers.Class({initialize:function(){return OpenLayers.Util.extend(this,{image:{envelope:null,output:""},features:{featurecount:0,envelope:null,feature:[]},error:""})},CLASS_NAME:"OpenLayers.Format.ArcXML.Response"});OpenLayers.ProxyHost="";OpenLayers.Request={DEFAULT_CONFIG:{method:"GET",url:window.location.href,async:!0,user:void 0,password:void 0,params:null,proxy:OpenLayers.ProxyHost,headers:{},data:null,callback:function(){},success:null,failure:null,scope:null},URL_SPLIT_REGEX:/([^:]*:)\/\/([^:]*:?[^@]*@)?([^:\/\?]*):?([^\/\?]*)/,
events:new OpenLayers.Events(this),makeSameOrigin:function(a,b){var c=0!==a.indexOf("http"),d=!c&&a.match(this.URL_SPLIT_REGEX);if(d){var e=window.location,c=d[1]==e.protocol&&d[3]==e.hostname,d=d[4],e=e.port;if(80!=d&&""!=d||"80"!=e&&""!=e)c=c&&d==e}c||(b?a="function"==typeof b?b(a):b+encodeURIComponent(a):OpenLayers.Console.warn(OpenLayers.i18n("proxyNeeded"),{url:a}));return a},issue:function(a){var b=OpenLayers.Util.extend(this.DEFAULT_CONFIG,{proxy:OpenLayers.ProxyHost}),a=OpenLayers.Util.applyDefaults(a,b),b=!1,c;for(c in a.headers)a.headers.hasOwnProperty(c)&&"x-requested-with"===c.toLowerCase()&&(b=!0);!1===b&&(a.headers["X-Requested-With"]="XMLHttpRequest");var d=new OpenLayers.Request.XMLHttpRequest,e=OpenLayers.Util.urlAppend(a.url,OpenLayers.Util.getParameterString(a.params||{})),e=OpenLayers.Request.makeSameOrigin(e,a.proxy);d.open(a.method,e,a.async,a.user,a.password);for(var f in a.headers)d.setRequestHeader(f,a.headers[f]);var g=this.events,h=this;d.onreadystatechange=function(){d.readyState==OpenLayers.Request.XMLHttpRequest.DONE&&!1!==g.triggerEvent("complete",{request:d,config:a,requestUrl:e})&&h.runCallbacks({request:d,config:a,requestUrl:e})};!1===a.async?d.send(a.data):window.setTimeout(function(){0!==d.readyState&&d.send(a.data)},0);return d},runCallbacks:function(a){var b=a.request,c=a.config,d=c.scope?OpenLayers.Function.bind(c.callback,c.scope):c.callback,e;c.success&&(e=c.scope?OpenLayers.Function.bind(c.success,c.scope):c.success);var f;c.failure&&(f=c.scope?OpenLayers.Function.bind(c.failure,c.scope):c.failure);"file:"==OpenLayers.Util.createUrlObject(c.url).protocol&&b.responseText&&(b.status=200);d(b);if(!b.status||200<=b.status&&300>b.status)this.events.triggerEvent("success",a),e&&e(b);if(b.status&&(200>b.status||300<=b.status))this.events.triggerEvent("failure",a),f&&f(b)},GET:function(a){a=OpenLayers.Util.extend(a,{method:"GET"});return OpenLayers.Request.issue(a)},POST:function(a){a=OpenLayers.Util.extend(a,{method:"POST"});a.headers=a.headers?a.headers:{};"CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(a.headers)||(a.headers["Content-Type"]="application/xml");return OpenLayers.Request.issue(a)},PUT:function(a){a=OpenLayers.Util.extend(a,{method:"PUT"});a.headers=a.headers?a.headers:{};"CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(a.headers)||(a.headers["Content-Type"]="application/xml");return OpenLayers.Request.issue(a)},DELETE:function(a){a=OpenLayers.Util.extend(a,{method:"DELETE"});return OpenLayers.Request.issue(a)},HEAD:function(a){a=OpenLayers.Util.extend(a,{method:"HEAD"});return OpenLayers.Request.issue(a)},OPTIONS:function(a){a=OpenLayers.Util.extend(a,{method:"OPTIONS"});return OpenLayers.Request.issue(a)}};OpenLayers.Layer.ArcIMS=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{ClientVersion:"9.2",ServiceName:""},featureCoordSys:"4326",filterCoordSys:"4326",layers:null,async:!0,name:"ArcIMS",isBaseLayer:!0,DEFAULT_OPTIONS:{tileSize:new OpenLayers.Size(512,512),featureCoordSys:"4326",filterCoordSys:"4326",layers:null,isBaseLayer:!0,async:!0,name:"ArcIMS"},initialize:function(a,b,c){this.tileSize=new OpenLayers.Size(512,512);this.params=OpenLayers.Util.applyDefaults({ServiceName:c.serviceName},this.DEFAULT_PARAMS);this.options=OpenLayers.Util.applyDefaults(c,this.DEFAULT_OPTIONS);OpenLayers.Layer.Grid.prototype.initialize.apply(this,[a,b,this.params,c]);if(this.transparent&&(this.isBaseLayer||(this.isBaseLayer=!1),"image/jpeg"==this.format))this.format=OpenLayers.Util.alphaHack()?"image/gif":"image/png";null===this.options.layers&&(this.options.layers=[])},getURL:function(a){var b="",a=this.adjustBounds(a),a=new OpenLayers.Format.ArcXML(OpenLayers.Util.extend(this.options,{requesttype:"image",envelope:a.toArray(),tileSize:this.tileSize})),a=new OpenLayers.Request.POST({url:this.getFullRequestString(),data:a.write(),async:!1});if(null!=a){b=a.responseXML;if(!b||!b.documentElement)b=a.responseText;b=this.getUrlOrImage((new OpenLayers.Format.ArcXML).read(b).image.output)}return b},getURLasync:function(a,b,c){a=this.adjustBounds(a);a=new OpenLayers.Format.ArcXML(OpenLayers.Util.extend(this.options,{requesttype:"image",envelope:a.toArray(),tileSize:this.tileSize}));OpenLayers.Request.POST({url:this.getFullRequestString(),async:!0,data:a.write(),callback:function(a){var e=a.responseXML;if(!e||!e.documentElement)e=a.responseText;a=(new OpenLayers.Format.ArcXML).read(e);b.call(c,this.getUrlOrImage(a.image.output))},scope:this})},getUrlOrImage:function(a){var b="";a.url?b=a.url:a.data&&(b="data:image/"+a.type+";base64,"+a.data);return b},setLayerQuery:function(a,b){for(var c=0;c<this.options.layers.length;c++)if(a==this.options.layers[c].id){this.options.layers[c].query=b;return}this.options.layers.push({id:a,visible:!0,query:b})},getFeatureInfo:function(a,b,c){var d=c.buffer||1,e=c.callback||function(){},f=c.scope||window,g={};OpenLayers.Util.extend(g,this.options);g.requesttype="feature";a instanceof OpenLayers.LonLat?(g.polygon=null,g.envelope=[a.lon-d,a.lat-d,a.lon+d,a.lat+d]):a instanceof OpenLayers.Geometry.Polygon&&(g.envelope=null,g.polygon=a);var h=new OpenLayers.Format.ArcXML(g);OpenLayers.Util.extend(h.request.get_feature,c);h.request.get_feature.layer=b.id;"number"==typeof b.query.accuracy?h.request.get_feature.query.accuracy=b.query.accuracy:(a=this.map.getCenter(),c=this.map.getViewPortPxFromLonLat(a),c.x++,c=this.map.getLonLatFromPixel(c),h.request.get_feature.query.accuracy=c.lon-a.lon);h.request.get_feature.query.where=b.query.where;h.request.get_feature.query.spatialfilter.relation="area_intersection";OpenLayers.Request.POST({url:this.getFullRequestString({CustomService:"Query"}),data:h.write(),callback:function(a){a=h.parseResponse(a.responseText);h.iserror()?e.call(f,null):e.call(f,a.features)}})},clone:function(a){null==a&&(a=new OpenLayers.Layer.ArcIMS(this.name,this.url,this.getOptions()));return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a])},CLASS_NAME:"OpenLayers.Layer.ArcIMS"});OpenLayers.Format.OWSCommon.v1_1_0=OpenLayers.Class(OpenLayers.Format.OWSCommon.v1,{namespaces:{ows:"http://www.opengis.net/ows/1.1",xlink:"http://www.w3.org/1999/xlink"},readers:{ows:OpenLayers.Util.applyDefaults({ExceptionReport:function(a,b){b.exceptionReport={version:a.getAttribute("version"),language:a.getAttribute("xml:lang"),exceptions:[]};this.readChildNodes(a,b.exceptionReport)},AllowedValues:function(a,b){b.allowedValues={};this.readChildNodes(a,b.allowedValues)},AnyValue:function(a,b){b.anyValue=!0},DataType:function(a,b){b.dataType=this.getChildValue(a)},Range:function(a,b){b.range={};this.readChildNodes(a,b.range)},MinimumValue:function(a,b){b.minValue=this.getChildValue(a)},MaximumValue:function(a,b){b.maxValue=this.getChildValue(a)},Identifier:function(a,b){b.identifier=this.getChildValue(a)},SupportedCRS:function(a,b){b.supportedCRS=this.getChildValue(a)}},OpenLayers.Format.OWSCommon.v1.prototype.readers.ows)},writers:{ows:OpenLayers.Util.applyDefaults({Range:function(a){var b=this.createElementNSPlus("ows:Range",{attributes:{"ows:rangeClosure":a.closure}});this.writeNode("ows:MinimumValue",a.minValue,b);this.writeNode("ows:MaximumValue",a.maxValue,b);return b},MinimumValue:function(a){return this.createElementNSPlus("ows:MinimumValue",{value:a})},MaximumValue:function(a){return this.createElementNSPlus("ows:MaximumValue",{value:a})},Value:function(a){return this.createElementNSPlus("ows:Value",{value:a})}},OpenLayers.Format.OWSCommon.v1.prototype.writers.ows)},CLASS_NAME:"OpenLayers.Format.OWSCommon.v1_1_0"});OpenLayers.Format.WCSGetCoverage=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ows:"http://www.opengis.net/ows/1.1",wcs:"http://www.opengis.net/wcs/1.1",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},VERSION:"1.1.2",schemaLocation:"http://www.opengis.net/wcs/1.1 http://schemas.opengis.net/wcs/1.1/wcsGetCoverage.xsd",write:function(a){a=this.writeNode("wcs:GetCoverage",a);this.setAttributeNS(a,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[a])},writers:{wcs:{GetCoverage:function(a){var b=this.createElementNSPlus("wcs:GetCoverage",{attributes:{version:a.version||this.VERSION,service:"WCS"}});this.writeNode("ows:Identifier",a.identifier,b);this.writeNode("wcs:DomainSubset",a.domainSubset,b);this.writeNode("wcs:Output",a.output,b);return b},DomainSubset:function(a){var b=this.createElementNSPlus("wcs:DomainSubset",{});this.writeNode("ows:BoundingBox",a.boundingBox,b);a.temporalSubset&&this.writeNode("wcs:TemporalSubset",a.temporalSubset,b);return b},TemporalSubset:function(a){for(var b=this.createElementNSPlus("wcs:TemporalSubset",{}),c=0,d=a.timePeriods.length;c<d;++c)this.writeNode("wcs:TimePeriod",a.timePeriods[c],b);return b},TimePeriod:function(a){var b=this.createElementNSPlus("wcs:TimePeriod",{});this.writeNode("wcs:BeginPosition",a.begin,b);this.writeNode("wcs:EndPosition",a.end,b);a.resolution&&this.writeNode("wcs:TimeResolution",a.resolution,b);return b},BeginPosition:function(a){return this.createElementNSPlus("wcs:BeginPosition",{value:a})},EndPosition:function(a){return this.createElementNSPlus("wcs:EndPosition",{value:a})},TimeResolution:function(a){return this.createElementNSPlus("wcs:TimeResolution",{value:a})},Output:function(a){var b=this.createElementNSPlus("wcs:Output",{attributes:{format:a.format,store:a.store}});a.gridCRS&&this.writeNode("wcs:GridCRS",a.gridCRS,b);return b},GridCRS:function(a){var b=this.createElementNSPlus("wcs:GridCRS",{});this.writeNode("wcs:GridBaseCRS",a.baseCRS,b);a.type&&this.writeNode("wcs:GridType",a.type,b);a.origin&&this.writeNode("wcs:GridOrigin",a.origin,b);this.writeNode("wcs:GridOffsets",a.offsets,b);a.CS&&this.writeNode("wcs:GridCS",a.CS,b);return b},GridBaseCRS:function(a){return this.createElementNSPlus("wcs:GridBaseCRS",{value:a})},GridOrigin:function(a){return this.createElementNSPlus("wcs:GridOrigin",{value:a})},GridType:function(a){return this.createElementNSPlus("wcs:GridType",{value:a})},GridOffsets:function(a){return this.createElementNSPlus("wcs:GridOffsets",{value:a})},GridCS:function(a){return this.createElementNSPlus("wcs:GridCS",{value:a})}},ows:OpenLayers.Format.OWSCommon.v1_1_0.prototype.writers.ows},CLASS_NAME:"OpenLayers.Format.WCSGetCoverage"});OpenLayers.Format.WPSExecute=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ows:"http://www.opengis.net/ows/1.1",gml:"http://www.opengis.net/gml",wps:"http://www.opengis.net/wps/1.0.0",wfs:"http://www.opengis.net/wfs",ogc:"http://www.opengis.net/ogc",wcs:"http://www.opengis.net/wcs",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},VERSION:"1.0.0",schemaLocation:"http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd",schemaLocationAttr:function(){},write:function(a){var b;window.ActiveXObject?this.xmldom=b=new ActiveXObject("Microsoft.XMLDOM"):b=document.implementation.createDocument("","",null);a=this.writeNode("wps:Execute",a,b);this.setAttributeNS(a,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[a])},writers:{wps:{Execute:function(a){var b=this.createElementNSPlus("wps:Execute",{attributes:{version:this.VERSION,service:"WPS"}});this.writeNode("ows:Identifier",a.identifier,b);this.writeNode("wps:DataInputs",a.dataInputs,b);this.writeNode("wps:ResponseForm",a.responseForm,b);return b},ResponseForm:function(a){var b=this.createElementNSPlus("wps:ResponseForm",{});a.rawDataOutput&&this.writeNode("wps:RawDataOutput",a.rawDataOutput,b);a.responseDocument&&this.writeNode("wps:ResponseDocument",a.responseDocument,b);return b},ResponseDocument:function(a){var b=this.createElementNSPlus("wps:ResponseDocument",{attributes:{storeExecuteResponse:a.storeExecuteResponse,lineage:a.lineage,status:a.status}});a.output&&this.writeNode("wps:Output",a.output,b);return b},Output:function(a){var b=this.createElementNSPlus("wps:Output",{attributes:{asReference:a.asReference}});this.writeNode("ows:Identifier",a.identifier,b);this.writeNode("ows:Title",a.title,b);this.writeNode("ows:Abstract",a["abstract"],b);return b},RawDataOutput:function(a){var b=this.createElementNSPlus("wps:RawDataOutput",{attributes:{mimeType:a.mimeType}});this.writeNode("ows:Identifier",a.identifier,b);return b},DataInputs:function(a){for(var b=this.createElementNSPlus("wps:DataInputs",{}),c=0,d=a.length;c<d;++c)this.writeNode("wps:Input",a[c],b);return b},Input:function(a){var b=this.createElementNSPlus("wps:Input",{});this.writeNode("ows:Identifier",a.identifier,b);a.title&&this.writeNode("ows:Title",a.title,b);a.data&&this.writeNode("wps:Data",a.data,b);a.reference&&this.writeNode("wps:Reference",a.reference,b);return b},Data:function(a){var b=this.createElementNSPlus("wps:Data",{});a.literalData?this.writeNode("wps:LiteralData",a.literalData,b):a.complexData&&this.writeNode("wps:ComplexData",a.complexData,b);return b},LiteralData:function(a){return this.createElementNSPlus("wps:LiteralData",{attributes:{uom:a.uom},value:a.value})},ComplexData:function(a){var b=this.createElementNSPlus("wps:ComplexData",{attributes:{mimeType:a.mimeType,encoding:a.encoding,schema:a.schema}}),c=a.value;"string"===typeof c?b.appendChild(this.getXMLDoc().createCDATASection(a.value)):b.appendChild(c);return b},Reference:function(a){var b=this.createElementNSPlus("wps:Reference",{attributes:{mimeType:a.mimeType,"xlink:href":a.href,method:a.method,encoding:a.encoding,schema:a.schema}});a.body&&this.writeNode("wps:Body",a.body,b);return b},Body:function(a){var b=this.createElementNSPlus("wps:Body",{});a.wcs?this.writeNode("wcs:GetCoverage",a.wcs,b):a.wfs?(this.featureType=a.wfs.featureType,this.version=a.wfs.version,this.writeNode("wfs:GetFeature",a.wfs,b)):this.writeNode("wps:Execute",a,b);return b}},wcs:OpenLayers.Format.WCSGetCoverage.prototype.writers.wcs,wfs:OpenLayers.Format.WFST.v1_1_0.prototype.writers.wfs,ogc:OpenLayers.Format.Filter.v1_1_0.prototype.writers.ogc,ows:OpenLayers.Format.OWSCommon.v1_1_0.prototype.writers.ows},CLASS_NAME:"OpenLayers.Format.WPSExecute"});OpenLayers.Control.PanZoom=OpenLayers.Class(OpenLayers.Control,{slideFactor:50,slideRatio:null,buttons:null,position:null,initialize:function(a){this.position=new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,OpenLayers.Control.PanZoom.Y);OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.map&&this.map.events.unregister("buttonclick",this,this.onButtonClick);this.removeButtons();this.position=this.buttons=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.register("buttonclick",this,this.onButtonClick)},draw:function(a){OpenLayers.Control.prototype.draw.apply(this,arguments);a=this.position;this.buttons=[];var b={w:18,h:18},c=new OpenLayers.Pixel(a.x+b.w/2,a.y);this._addButton("panup","north-mini.png",c,b);a.y=c.y+b.h;this._addButton("panleft","west-mini.png",a,b);this._addButton("panright","east-mini.png",a.add(b.w,0),b);this._addButton("pandown","south-mini.png",c.add(0,2*b.h),b);this._addButton("zoomin","zoom-plus-mini.png",c.add(0,3*b.h+5),b);this._addButton("zoomworld","zoom-world-mini.png",c.add(0,4*b.h+5),b);this._addButton("zoomout","zoom-minus-mini.png",c.add(0,5*b.h+5),b);return this.div},_addButton:function(a,b,c,d){b=OpenLayers.Util.getImageLocation(b);c=OpenLayers.Util.createAlphaImageDiv(this.id+"_"+a,c,d,b,"absolute");c.style.cursor="pointer";this.div.appendChild(c);c.action=a;c.className="olButton";this.buttons.push(c);return c},_removeButton:function(a){this.div.removeChild(a);OpenLayers.Util.removeItem(this.buttons,a)},removeButtons:function(){for(var a=this.buttons.length-1;0<=a;--a)this._removeButton(this.buttons[a])},onButtonClick:function(a){switch(a.buttonElement.action){case"panup":this.map.pan(0,-this.getSlideFactor("h"));break;case"pandown":this.map.pan(0,this.getSlideFactor("h"));break;case"panleft":this.map.pan(-this.getSlideFactor("w"),0);break;case"panright":this.map.pan(this.getSlideFactor("w"),0);break;case"zoomin":this.map.zoomIn();break;case"zoomout":this.map.zoomOut();break;case"zoomworld":this.map.zoomToMaxExtent()}},getSlideFactor:function(a){return this.slideRatio?this.map.getSize()[a]*this.slideRatio:this.slideFactor},CLASS_NAME:"OpenLayers.Control.PanZoom"});OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;OpenLayers.Control.PanZoomBar=OpenLayers.Class(OpenLayers.Control.PanZoom,{zoomStopWidth:18,zoomStopHeight:11,slider:null,sliderEvents:null,zoombarDiv:null,zoomWorldIcon:!1,panIcons:!0,forceFixedZoomLevel:!1,mouseDragStart:null,deltaY:null,zoomStart:null,destroy:function(){this._removeZoomBar();this.map.events.un({changebaselayer:this.redraw,scope:this});OpenLayers.Control.PanZoom.prototype.destroy.apply(this,arguments);delete this.mouseDragStart;delete this.zoomStart},setMap:function(a){OpenLayers.Control.PanZoom.prototype.setMap.apply(this,arguments);this.map.events.register("changebaselayer",this,this.redraw)},redraw:function(){null!=this.div&&(this.removeButtons(),this._removeZoomBar());this.draw()},draw:function(a){OpenLayers.Control.prototype.draw.apply(this,arguments);a=this.position.clone();this.buttons=[];var b={w:18,h:18};if(this.panIcons){var c=new OpenLayers.Pixel(a.x+b.w/2,a.y),d=b.w;this.zoomWorldIcon&&(c=new OpenLayers.Pixel(a.x+b.w,a.y));this._addButton("panup","north-mini.png",c,b);a.y=c.y+b.h;this._addButton("panleft","west-mini.png",a,b);this.zoomWorldIcon&&(this._addButton("zoomworld","zoom-world-mini.png",a.add(b.w,0),b),d*=2);this._addButton("panright","east-mini.png",a.add(d,0),b);this._addButton("pandown","south-mini.png",c.add(0,2*b.h),b);this._addButton("zoomin","zoom-plus-mini.png",c.add(0,3*b.h+5),b);c=this._addZoomBar(c.add(0,4*b.h+5));this._addButton("zoomout","zoom-minus-mini.png",c,b)}else this._addButton("zoomin","zoom-plus-mini.png",a,b),c=this._addZoomBar(a.add(0,b.h)),this._addButton("zoomout","zoom-minus-mini.png",c,b),this.zoomWorldIcon&&(c=c.add(0,b.h+3),this._addButton("zoomworld","zoom-world-mini.png",c,b));return this.div},_addZoomBar:function(a){var b=OpenLayers.Util.getImageLocation("slider.png"),c=this.id+"_"+this.map.id,d=this.map.getNumZoomLevels()-1-this.map.getZoom(),d=OpenLayers.Util.createAlphaImageDiv(c,a.add(-1,d*this.zoomStopHeight),{w:20,h:9},b,"absolute");d.style.cursor="move";this.slider=d;this.sliderEvents=new OpenLayers.Events(this,d,null,!0,{includeXY:!0});this.sliderEvents.on({touchstart:this.zoomBarDown,touchmove:this.zoomBarDrag,touchend:this.zoomBarUp,mousedown:this.zoomBarDown,mousemove:this.zoomBarDrag,mouseup:this.zoomBarUp});var e={w:this.zoomStopWidth,h:this.zoomStopHeight*this.map.getNumZoomLevels()},b=OpenLayers.Util.getImageLocation("zoombar.png"),c=null;OpenLayers.Util.alphaHack()?(c=this.id+"_"+this.map.id,c=OpenLayers.Util.createAlphaImageDiv(c,a,{w:e.w,h:this.zoomStopHeight},b,"absolute",null,"crop"),c.style.height=e.h+"px"):c=OpenLayers.Util.createDiv("OpenLayers_Control_PanZoomBar_Zoombar"+this.map.id,a,e,b);c.style.cursor="pointer";c.className="olButton";this.zoombarDiv=c;this.div.appendChild(c);this.startTop=parseInt(c.style.top);this.div.appendChild(d);this.map.events.register("zoomend",this,this.moveZoomBar);return a=a.add(0,this.zoomStopHeight*this.map.getNumZoomLevels())},_removeZoomBar:function(){this.sliderEvents.un({touchstart:this.zoomBarDown,touchmove:this.zoomBarDrag,touchend:this.zoomBarUp,mousedown:this.zoomBarDown,mousemove:this.zoomBarDrag,mouseup:this.zoomBarUp});this.sliderEvents.destroy();this.div.removeChild(this.zoombarDiv);this.zoombarDiv=null;this.div.removeChild(this.slider);this.slider=null;this.map.events.unregister("zoomend",this,this.moveZoomBar)},onButtonClick:function(a){OpenLayers.Control.PanZoom.prototype.onButtonClick.apply(this,arguments);if(a.buttonElement===this.zoombarDiv){var b=a.buttonXY.y/this.zoomStopHeight;if(this.forceFixedZoomLevel||!this.map.fractionalZoom)b=Math.floor(b);b=this.map.getNumZoomLevels()-1-b;b=Math.min(Math.max(b,0),this.map.getNumZoomLevels()-1);this.map.zoomTo(b)}},passEventToSlider:function(a){this.sliderEvents.handleBrowserEvent(a)},zoomBarDown:function(a){if(OpenLayers.Event.isLeftClick(a)||OpenLayers.Event.isSingleTouch(a))this.map.events.on({touchmove:this.passEventToSlider,mousemove:this.passEventToSlider,mouseup:this.passEventToSlider,scope:this}),this.mouseDragStart=a.xy.clone(),this.zoomStart=a.xy.clone(),this.div.style.cursor="move",this.zoombarDiv.offsets=null,OpenLayers.Event.stop(a)},zoomBarDrag:function(a){if(null!=this.mouseDragStart){var b=this.mouseDragStart.y-a.xy.y,c=OpenLayers.Util.pagePosition(this.zoombarDiv);0<a.clientY-c[1]&&a.clientY-c[1]<parseInt(this.zoombarDiv.style.height)-2&&(this.slider.style.top=parseInt(this.slider.style.top)-b+"px",this.mouseDragStart=a.xy.clone());this.deltaY=this.zoomStart.y-a.xy.y;OpenLayers.Event.stop(a)}},zoomBarUp:function(a){if((OpenLayers.Event.isLeftClick(a)||"touchend"===a.type)&&this.mouseDragStart){this.div.style.cursor="";this.map.events.un({touchmove:this.passEventToSlider,mouseup:this.passEventToSlider,mousemove:this.passEventToSlider,scope:this});var b=this.map.zoom;!this.forceFixedZoomLevel&&this.map.fractionalZoom?(b+=this.deltaY/this.zoomStopHeight,b=Math.min(Math.max(b,0),this.map.getNumZoomLevels()-1)):(b+=this.deltaY/this.zoomStopHeight,b=Math.max(Math.round(b),0));this.map.zoomTo(b);this.zoomStart=this.mouseDragStart=null;this.deltaY=0;OpenLayers.Event.stop(a)}},moveZoomBar:function(){this.slider.style.top=(this.map.getNumZoomLevels()-1-this.map.getZoom())*this.zoomStopHeight+this.startTop+1+"px"},CLASS_NAME:"OpenLayers.Control.PanZoomBar"});OpenLayers.Format.WFSCapabilities=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{defaultVersion:"1.1.0",errorProperty:"service",CLASS_NAME:"OpenLayers.Format.WFSCapabilities"});OpenLayers.Format.WFSCapabilities.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{wfs:"http://www.opengis.net/wfs",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",ows:"http://www.opengis.net/ows"},defaultPrefix:"wfs",read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a&&9==a.nodeType&&(a=a.documentElement);var b={};this.readNode(a,b);return b},readers:{wfs:{WFS_Capabilities:function(a,b){this.readChildNodes(a,b)},FeatureTypeList:function(a,b){b.featureTypeList={featureTypes:[]};this.readChildNodes(a,b.featureTypeList)},FeatureType:function(a,b){var c={};this.readChildNodes(a,c);b.featureTypes.push(c)},Name:function(a,b){var c=this.getChildValue(a);c&&(c=c.split(":"),b.name=c.pop(),0<c.length&&(b.featureNS=this.lookupNamespaceURI(a,c[0])))},Title:function(a,b){var c=this.getChildValue(a);c&&(b.title=c)},Abstract:function(a,b){var c=this.getChildValue(a);c&&(b["abstract"]=c)}}},CLASS_NAME:"OpenLayers.Format.WFSCapabilities.v1"});OpenLayers.Format.WFSCapabilities.v1_1_0=OpenLayers.Class(OpenLayers.Format.WFSCapabilities.v1,{regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},readers:{wfs:OpenLayers.Util.applyDefaults({DefaultSRS:function(a,b){var c=this.getChildValue(a);c&&(b.srs=c)}},OpenLayers.Format.WFSCapabilities.v1.prototype.readers.wfs),ows:OpenLayers.Format.OWSCommon.v1.prototype.readers.ows},CLASS_NAME:"OpenLayers.Format.WFSCapabilities.v1_1_0"});OpenLayers.Layer.Image=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:!0,url:null,extent:null,size:null,tile:null,aspectRatio:null,initialize:function(a,b,c,d,e){this.url=b;this.maxExtent=this.extent=c;this.size=d;OpenLayers.Layer.prototype.initialize.apply(this,[a,e]);this.aspectRatio=this.extent.getHeight()/this.size.h/(this.extent.getWidth()/this.size.w)},destroy:function(){this.tile&&(this.removeTileMonitoringHooks(this.tile),this.tile.destroy(),this.tile=null);OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){null==a&&(a=new OpenLayers.Layer.Image(this.name,this.url,this.extent,this.size,this.getOptions()));return a=OpenLayers.Layer.prototype.clone.apply(this,[a])},setMap:function(a){null==this.options.maxResolution&&(this.options.maxResolution=this.aspectRatio*this.extent.getWidth()/this.size.w);OpenLayers.Layer.prototype.setMap.apply(this,arguments)},moveTo:function(a,b,c){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var d=null==this.tile;if(b||d){this.setTileSize();var e=this.map.getLayerPxFromLonLat({lon:this.extent.left,lat:this.extent.top});d?(this.tile=new OpenLayers.Tile.Image(this,e,this.extent,null,this.tileSize),this.addTileMonitoringHooks(this.tile)):(this.tile.size=this.tileSize.clone(),this.tile.position=e.clone());this.tile.draw()}},setTileSize:function(){var a=this.extent.getWidth()/this.map.getResolution(),b=this.extent.getHeight()/this.map.getResolution();this.tileSize=new OpenLayers.Size(a,b)},addTileMonitoringHooks:function(a){a.onLoadStart=function(){this.events.triggerEvent("loadstart")};a.events.register("loadstart",this,a.onLoadStart);a.onLoadEnd=function(){this.events.triggerEvent("loadend")};a.events.register("loadend",this,a.onLoadEnd);a.events.register("unload",this,a.onLoadEnd)},removeTileMonitoringHooks:function(a){a.unload();a.events.un({loadstart:a.onLoadStart,loadend:a.onLoadEnd,unload:a.onLoadEnd,scope:this})},setUrl:function(a){this.url=a;this.tile.draw()},getURL:function(){return this.url},CLASS_NAME:"OpenLayers.Layer.Image"});OpenLayers.Strategy=OpenLayers.Class({layer:null,options:null,active:null,autoActivate:!0,autoDestroy:!0,initialize:function(a){OpenLayers.Util.extend(this,a);this.options=a;this.active=!1},destroy:function(){this.deactivate();this.options=this.layer=null},setLayer:function(a){this.layer=a},activate:function(){return!this.active?this.active=!0:!1},deactivate:function(){return this.active?(this.active=!1,!0):!1},CLASS_NAME:"OpenLayers.Strategy"});OpenLayers.Strategy.Save=OpenLayers.Class(OpenLayers.Strategy,{events:null,auto:!1,timer:null,initialize:function(a){OpenLayers.Strategy.prototype.initialize.apply(this,[a]);this.events=new OpenLayers.Events(this)},activate:function(){var a=OpenLayers.Strategy.prototype.activate.call(this);if(a&&this.auto)if("number"===typeof this.auto)this.timer=window.setInterval(OpenLayers.Function.bind(this.save,this),1e3*this.auto);else this.layer.events.on({featureadded:this.triggerSave,afterfeaturemodified:this.triggerSave,scope:this});return a},deactivate:function(){var a=OpenLayers.Strategy.prototype.deactivate.call(this);a&&this.auto&&("number"===typeof this.auto?window.clearInterval(this.timer):this.layer.events.un({featureadded:this.triggerSave,afterfeaturemodified:this.triggerSave,scope:this}));return a},triggerSave:function(a){var b=a.feature;(b.state===OpenLayers.State.INSERT||b.state===OpenLayers.State.UPDATE||b.state===OpenLayers.State.DELETE)&&this.save([a.feature])},save:function(a){a||(a=this.layer.features);this.events.triggerEvent("start",{features:a});var b=this.layer.projection,c=this.layer.map.getProjectionObject();if(!c.equals(b)){for(var d=a.length,e=Array(d),f,g,h=0;h<d;++h)f=a[h],g=f.clone(),g.fid=f.fid,g.state=f.state,f.url&&(g.url=f.url),g._original=f,g.geometry.transform(c,b),e[h]=g;a=e}this.layer.protocol.commit(a,{callback:this.onCommit,scope:this})},onCommit:function(a){var b={response:a};if(a.success()){for(var c=a.reqFeatures,d,e=[],f=a.insertIds||[],g=0,h=0,i=c.length;h<i;++h)if(d=c[h],d=d._original||d,a=d.state)a==OpenLayers.State.DELETE?e.push(d):a==OpenLayers.State.INSERT&&(d.fid=f[g],++g),d.state=null;0<e.length&&this.layer.destroyFeatures(e);this.events.triggerEvent("success",b)}else this.events.triggerEvent("fail",b)},CLASS_NAME:"OpenLayers.Strategy.Save"});OpenLayers.Format.GPX=OpenLayers.Class(OpenLayers.Format.XML,{defaultDesc:"No description available",extractWaypoints:!0,extractTracks:!0,extractRoutes:!0,extractAttributes:!0,namespaces:{gpx:"http://www.topografix.com/GPX/1/1",xsi:"http://www.w3.org/2001/XMLSchema-instance"},schemaLocation:"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd",creator:"OpenLayers",initialize:function(a){this.externalProjection=new OpenLayers.Projection("EPSG:4326");OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));var b=[];if(this.extractTracks)for(var c=a.getElementsByTagName("trk"),d=0,e=c.length;d<e;d++){var f={};this.extractAttributes&&(f=this.parseAttributes(c[d]));for(var g=this.getElementsByTagNameNS(c[d],c[d].namespaceURI,"trkseg"),h=0,i=g.length;h<i;h++){var j=this.extractSegment(g[h],"trkpt");b.push(new OpenLayers.Feature.Vector(j,f))}}if(this.extractRoutes){e=a.getElementsByTagName("rte");c=0;for(d=e.length;c<d;c++)f={},this.extractAttributes&&(f=this.parseAttributes(e[c])),g=this.extractSegment(e[c],"rtept"),b.push(new OpenLayers.Feature.Vector(g,f))}if(this.extractWaypoints){a=a.getElementsByTagName("wpt");c=0;for(e=a.length;c<e;c++)f={},this.extractAttributes&&(f=this.parseAttributes(a[c])),d=new OpenLayers.Geometry.Point(a[c].getAttribute("lon"),a[c].getAttribute("lat")),b.push(new OpenLayers.Feature.Vector(d,f))}if(this.internalProjection&&this.externalProjection){f=0;for(a=b.length;f<a;f++)b[f].geometry.transform(this.externalProjection,this.internalProjection)}return b},extractSegment:function(a,b){for(var c=this.getElementsByTagNameNS(a,a.namespaceURI,b),d=[],e=0,f=c.length;e<f;e++)d.push(new OpenLayers.Geometry.Point(c[e].getAttribute("lon"),c[e].getAttribute("lat")));return new OpenLayers.Geometry.LineString(d)},parseAttributes:function(a){for(var b={},a=a.firstChild,c,d;a;){if(1==a.nodeType&&a.firstChild&&(c=a.firstChild,3==c.nodeType||4==c.nodeType))d=a.prefix?a.nodeName.split(":")[1]:a.nodeName,"trkseg"!=d&&"rtept"!=d&&(b[d]=c.nodeValue);a=a.nextSibling}return b},write:function(a,b){var a=OpenLayers.Util.isArray(a)?a:[a],c=this.createElementNS(this.namespaces.gpx,"gpx");c.setAttribute("version","1.1");c.setAttribute("creator",this.creator);this.setAttributes(c,{"xsi:schemaLocation":this.schemaLocation});b&&"object"==typeof b&&c.appendChild(this.buildMetadataNode(b));for(var d=0,e=a.length;d<e;d++)c.appendChild(this.buildFeatureNode(a[d]));return OpenLayers.Format.XML.prototype.write.apply(this,[c])},buildMetadataNode:function(a){for(var b=["name","desc","author"],c=this.createElementNSPlus("gpx:metadata"),d=0;d<b.length;d++){var e=b[d];if(a[e]){var f=this.createElementNSPlus("gpx:"+e);f.appendChild(this.createTextNode(a[e]));c.appendChild(f)}}return c},buildFeatureNode:function(a){var b=a.geometry,b=b.clone();this.internalProjection&&this.externalProjection&&b.transform(this.internalProjection,this.externalProjection);if("OpenLayers.Geometry.Point"==b.CLASS_NAME){var c=this.buildWptNode(b);this.appendAttributesNode(c,a);return c}c=this.createElementNSPlus("gpx:trk");this.appendAttributesNode(c,a);for(var a=this.buildTrkSegNode(b),a=OpenLayers.Util.isArray(a)?a:[a],b=0,d=a.length;b<d;b++)c.appendChild(a[b]);return c},buildTrkSegNode:function(a){var b,c,d,e;if("OpenLayers.Geometry.LineString"==a.CLASS_NAME||"OpenLayers.Geometry.LinearRing"==a.CLASS_NAME){b=this.createElementNSPlus("gpx:trkseg");c=0;for(d=a.components.length;c<d;c++)e=a.components[c],b.appendChild(this.buildTrkPtNode(e));return b}b=[];c=0;for(d=a.components.length;c<d;c++)b.push(this.buildTrkSegNode(a.components[c]));return b},buildTrkPtNode:function(a){var b=this.createElementNSPlus("gpx:trkpt");b.setAttribute("lon",a.x);b.setAttribute("lat",a.y);return b},buildWptNode:function(a){var b=this.createElementNSPlus("gpx:wpt");b.setAttribute("lon",a.x);b.setAttribute("lat",a.y);return b},appendAttributesNode:function(a,b){var c=this.createElementNSPlus("gpx:name");c.appendChild(this.createTextNode(b.attributes.name||b.id));a.appendChild(c);c=this.createElementNSPlus("gpx:desc");
c.appendChild(this.createTextNode(b.attributes.description||this.defaultDesc));a.appendChild(c)},CLASS_NAME:"OpenLayers.Format.GPX"});OpenLayers.Format.WMSDescribeLayer=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{defaultVersion:"1.1.1",getVersion:function(a,b){var c=OpenLayers.Format.XML.VersionedOGC.prototype.getVersion.apply(this,arguments);if("1.1.1"==c||"1.1.0"==c)c="1.1";return c},CLASS_NAME:"OpenLayers.Format.WMSDescribeLayer"});OpenLayers.Format.WMSDescribeLayer.v1_1=OpenLayers.Class(OpenLayers.Format.WMSDescribeLayer,{initialize:function(a){OpenLayers.Format.WMSDescribeLayer.prototype.initialize.apply(this,[a])},read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));for(var a=a.documentElement.childNodes,b=[],c,d,e=0;e<a.length;++e)if(c=a[e],d=c.nodeName,"LayerDescription"==d){d=c.getAttribute("name");var f="",g="",h="";c.getAttribute("owsType")?(f=c.getAttribute("owsType"),g=c.getAttribute("owsURL")):""!=c.getAttribute("wfs")?(f="WFS",g=c.getAttribute("wfs")):""!=c.getAttribute("wcs")&&(f="WCS",g=c.getAttribute("wcs"));c=c.getElementsByTagName("Query");0<c.length&&((h=c[0].getAttribute("typeName"))||(h=c[0].getAttribute("typename")));b.push({layerName:d,owsType:f,owsURL:g,typeName:h})}return b},CLASS_NAME:"OpenLayers.Format.WMSDescribeLayer.v1_1"});OpenLayers.Layer.XYZ=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:!0,sphericalMercator:!1,zoomOffset:0,serverResolutions:null,initialize:function(a,b,c){if(c&&c.sphericalMercator||this.sphericalMercator)c=OpenLayers.Util.extend({projection:"EPSG:900913",numZoomLevels:19},c);OpenLayers.Layer.Grid.prototype.initialize.apply(this,[a||this.name,b||this.url,{},c])},clone:function(a){null==a&&(a=new OpenLayers.Layer.XYZ(this.name,this.url,this.getOptions()));return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a])},getURL:function(a){var a=this.getXYZ(a),b=this.url;OpenLayers.Util.isArray(b)&&(b=this.selectUrl(""+a.x+a.y+a.z,b));return OpenLayers.String.format(b,a)},getXYZ:function(a){var b=this.getServerResolution(),c=Math.round((a.left-this.maxExtent.left)/(b*this.tileSize.w)),a=Math.round((this.maxExtent.top-a.top)/(b*this.tileSize.h)),b=this.getServerZoom();if(this.wrapDateLine)var d=Math.pow(2,b),c=(c%d+d)%d;return{x:c,y:a,z:b}},setMap:function(a){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);this.tileOrigin||(this.tileOrigin=new OpenLayers.LonLat(this.maxExtent.left,this.maxExtent.bottom))},CLASS_NAME:"OpenLayers.Layer.XYZ"});OpenLayers.Layer.OSM=OpenLayers.Class(OpenLayers.Layer.XYZ,{name:"OpenStreetMap",url:["http://a.tile.openstreetmap.org/${z}/${x}/${y}.png","http://b.tile.openstreetmap.org/${z}/${x}/${y}.png","http://c.tile.openstreetmap.org/${z}/${x}/${y}.png"],attribution:"Data CC-By-SA by <a href='http://openstreetmap.org/'>OpenStreetMap</a>",sphericalMercator:!0,wrapDateLine:!0,tileOptions:null,initialize:function(a,b,c){OpenLayers.Layer.XYZ.prototype.initialize.apply(this,arguments);this.tileOptions=OpenLayers.Util.extend({crossOriginKeyword:"anonymous"},this.options&&this.options.tileOptions)},clone:function(a){null==a&&(a=new OpenLayers.Layer.OSM(this.name,this.url,this.getOptions()));return a=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[a])},CLASS_NAME:"OpenLayers.Layer.OSM"});OpenLayers.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:!1,size:null,resolution:null,map:null,featureDx:0,initialize:function(a,b){this.container=OpenLayers.Util.getElement(a);OpenLayers.Util.extend(this,b)},destroy:function(){this.map=this.resolution=this.size=this.extent=this.container=null},supported:function(){return!1},setExtent:function(a,b){this.extent=a.clone();if(this.map.baseLayer&&this.map.baseLayer.wrapDateLine){var c=a.getWidth()/this.map.getExtent().getWidth(),a=a.scale(1/c);this.extent=a.wrapDateLine(this.map.getMaxExtent()).scale(c)}b&&(this.resolution=null);return!0},setSize:function(a){this.size=a.clone();this.resolution=null},getResolution:function(){return this.resolution=this.resolution||this.map.getResolution()},drawFeature:function(a,b){null==b&&(b=a.style);if(a.geometry){var c=a.geometry.getBounds();if(c){var d;this.map.baseLayer&&this.map.baseLayer.wrapDateLine&&(d=this.map.getMaxExtent());c.intersectsBounds(this.extent,{worldBounds:d})?this.calculateFeatureDx(c,d):b={display:"none"};c=this.drawGeometry(a.geometry,b,a.id);if("none"!=b.display&&b.label&&!1!==c){d=a.geometry.getCentroid();if(b.labelXOffset||b.labelYOffset){var e=isNaN(b.labelXOffset)?0:b.labelXOffset,f=isNaN(b.labelYOffset)?0:b.labelYOffset,g=this.getResolution();d.move(e*g,f*g)}this.drawText(a.id,b,d)}else this.removeText(a.id);return c}}},calculateFeatureDx:function(a,b){this.featureDx=0;if(b){var c=b.getWidth();this.featureDx=Math.round(((a.left+a.right)/2-(this.extent.left+this.extent.right)/2)/c)*c}},drawGeometry:function(){},drawText:function(){},removeText:function(){},clear:function(){},getFeatureIdFromEvent:function(){},eraseFeatures:function(a){OpenLayers.Util.isArray(a)||(a=[a]);for(var b=0,c=a.length;b<c;++b){var d=a[b];this.eraseGeometry(d.geometry,d.id);this.removeText(d.id)}},eraseGeometry:function(){},moveRoot:function(){},getRenderLayerId:function(){return this.container.id},applyDefaultSymbolizer:function(a){var b=OpenLayers.Util.extend({},OpenLayers.Renderer.defaultSymbolizer);!1===a.stroke&&(delete b.strokeWidth,delete b.strokeColor);!1===a.fill&&delete b.fillColor;OpenLayers.Util.extend(b,a);return b},CLASS_NAME:"OpenLayers.Renderer"});OpenLayers.Renderer.defaultSymbolizer={fillColor:"#000000",strokeColor:"#000000",strokeWidth:2,fillOpacity:1,strokeOpacity:1,pointRadius:0,labelAlign:"cm"};OpenLayers.Renderer.symbol={star:[350,75,379,161,469,161,397,215,423,301,350,250,277,301,303,215,231,161,321,161,350,75],cross:[4,0,6,0,6,4,10,4,10,6,6,6,6,10,4,10,4,6,0,6,0,4,4,4,4,0],x:[0,0,25,0,50,35,75,0,100,0,65,50,100,100,75,100,50,65,25,100,0,100,35,50,0,0],square:[0,0,0,1,1,1,1,0,0,0],triangle:[0,10,10,10,5,0,0,10]};OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{hitDetection:!0,hitOverflow:0,canvas:null,features:null,pendingRedraw:!1,cachedSymbolBounds:{},initialize:function(a,b){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.root=document.createElement("canvas");this.container.appendChild(this.root);this.canvas=this.root.getContext("2d");this.features={};this.hitDetection&&(this.hitCanvas=document.createElement("canvas"),this.hitContext=this.hitCanvas.getContext("2d"))},setExtent:function(){OpenLayers.Renderer.prototype.setExtent.apply(this,arguments);return!1},eraseGeometry:function(a,b){this.eraseFeatures(this.features[b][0])},supported:function(){return OpenLayers.CANVAS_SUPPORTED},setSize:function(a){this.size=a.clone();var b=this.root;b.style.width=a.w+"px";b.style.height=a.h+"px";b.width=a.w;b.height=a.h;this.resolution=null;this.hitDetection&&(b=this.hitCanvas,b.style.width=a.w+"px",b.style.height=a.h+"px",b.width=a.w,b.height=a.h)},drawFeature:function(a,b){var c;if(a.geometry){b=this.applyDefaultSymbolizer(b||a.style);c=a.geometry.getBounds();var d;this.map.baseLayer&&this.map.baseLayer.wrapDateLine&&(d=this.map.getMaxExtent());d=c&&c.intersectsBounds(this.extent,{worldBounds:d});(c="none"!==b.display&&!!c&&d)?this.features[a.id]=[a,b]:delete this.features[a.id];this.pendingRedraw=!0}this.pendingRedraw&&!this.locked&&(this.redraw(),this.pendingRedraw=!1);return c},drawGeometry:function(a,b,c){var d=a.CLASS_NAME;if("OpenLayers.Geometry.Collection"==d||"OpenLayers.Geometry.MultiPoint"==d||"OpenLayers.Geometry.MultiLineString"==d||"OpenLayers.Geometry.MultiPolygon"==d)for(d=0;d<a.components.length;d++)this.drawGeometry(a.components[d],b,c);else switch(a.CLASS_NAME){case"OpenLayers.Geometry.Point":this.drawPoint(a,b,c);break;case"OpenLayers.Geometry.LineString":this.drawLineString(a,b,c);break;case"OpenLayers.Geometry.LinearRing":this.drawLinearRing(a,b,c);break;case"OpenLayers.Geometry.Polygon":this.drawPolygon(a,b,c)}},drawExternalGraphic:function(a,b,c){var d=new Image;b.graphicTitle&&(d.title=b.graphicTitle);var e=b.graphicWidth||b.graphicHeight,f=b.graphicHeight||b.graphicWidth,e=e?e:2*b.pointRadius,f=f?f:2*b.pointRadius,g=void 0!=b.graphicXOffset?b.graphicXOffset:-(.5*e),h=void 0!=b.graphicYOffset?b.graphicYOffset:-(.5*f),i=b.graphicOpacity||b.fillOpacity;d.onload=OpenLayers.Function.bind(function(){if(this.features[c]){var b=this.getLocalXY(a),k=b[0],b=b[1];if(!isNaN(k)&&!isNaN(b)){var k=k+g|0,b=b+h|0,l=this.canvas;l.globalAlpha=i;var m=OpenLayers.Renderer.Canvas.drawImageScaleFactor||(OpenLayers.Renderer.Canvas.drawImageScaleFactor=/android 2.1/.test(navigator.userAgent.toLowerCase())?320/window.screen.width:1);l.drawImage(d,k*m,b*m,e*m,f*m);if(this.hitDetection){this.setHitContextStyle("fill",c);this.hitContext.fillRect(k,b,e,f)}}}},this);d.src=b.externalGraphic},drawNamedSymbol:function(a,b,c){var d,e,f,g;f=Math.PI/180;var h=OpenLayers.Renderer.symbol[b.graphicName];if(!h)throw Error(b.graphicName+" is not a valid symbol name");if(h.length&&!(2>h.length)&&(a=this.getLocalXY(a),e=a[0],g=a[1],!isNaN(e)&&!isNaN(g))){this.canvas.lineCap="round";this.canvas.lineJoin="round";this.hitDetection&&(this.hitContext.lineCap="round",this.hitContext.lineJoin="round");if(b.graphicName in this.cachedSymbolBounds)d=this.cachedSymbolBounds[b.graphicName];else{d=new OpenLayers.Bounds;for(a=0;a<h.length;a+=2)d.extend(new OpenLayers.LonLat(h[a],h[a+1]));this.cachedSymbolBounds[b.graphicName]=d}this.canvas.save();this.hitDetection&&this.hitContext.save();this.canvas.translate(e,g);this.hitDetection&&this.hitContext.translate(e,g);a=f*b.rotation;isNaN(a)||(this.canvas.rotate(a),this.hitDetection&&this.hitContext.rotate(a));f=2*b.pointRadius/Math.max(d.getWidth(),d.getHeight());this.canvas.scale(f,f);this.hitDetection&&this.hitContext.scale(f,f);a=d.getCenterLonLat().lon;d=d.getCenterLonLat().lat;this.canvas.translate(-a,-d);this.hitDetection&&this.hitContext.translate(-a,-d);g=b.strokeWidth;b.strokeWidth=g/f;if(!1!==b.fill){this.setCanvasStyle("fill",b);this.canvas.beginPath();for(a=0;a<h.length;a+=2)d=h[a],e=h[a+1],0==a&&this.canvas.moveTo(d,e),this.canvas.lineTo(d,e);this.canvas.closePath();this.canvas.fill();if(this.hitDetection){this.setHitContextStyle("fill",c,b);this.hitContext.beginPath();for(a=0;a<h.length;a+=2)d=h[a],e=h[a+1],0==a&&this.canvas.moveTo(d,e),this.hitContext.lineTo(d,e);this.hitContext.closePath();this.hitContext.fill()}}if(!1!==b.stroke){this.setCanvasStyle("stroke",b);this.canvas.beginPath();for(a=0;a<h.length;a+=2)d=h[a],e=h[a+1],0==a&&this.canvas.moveTo(d,e),this.canvas.lineTo(d,e);this.canvas.closePath();this.canvas.stroke();if(this.hitDetection){this.setHitContextStyle("stroke",c,b,f);this.hitContext.beginPath();for(a=0;a<h.length;a+=2)d=h[a],e=h[a+1],0==a&&this.hitContext.moveTo(d,e),this.hitContext.lineTo(d,e);this.hitContext.closePath();this.hitContext.stroke()}}b.strokeWidth=g;this.canvas.restore();this.hitDetection&&this.hitContext.restore();this.setCanvasStyle("reset")}},setCanvasStyle:function(a,b){"fill"===a?(this.canvas.globalAlpha=b.fillOpacity,this.canvas.fillStyle=b.fillColor):"stroke"===a?(this.canvas.globalAlpha=b.strokeOpacity,this.canvas.strokeStyle=b.strokeColor,this.canvas.lineWidth=b.strokeWidth):(this.canvas.globalAlpha=0,this.canvas.lineWidth=1)},featureIdToHex:function(a){a=Number(a.split("_").pop())+1;16777216<=a&&(this.hitOverflow=a-16777215,a=a%16777216+1);var a="000000"+a.toString(16),b=a.length;return a="#"+a.substring(b-6,b)},setHitContextStyle:function(a,b,c,d){b=this.featureIdToHex(b);"fill"==a?(this.hitContext.globalAlpha=1,this.hitContext.fillStyle=b):"stroke"==a?(this.hitContext.globalAlpha=1,this.hitContext.strokeStyle=b,"undefined"===typeof d?this.hitContext.lineWidth=c.strokeWidth+2:isNaN(d)||(this.hitContext.lineWidth=c.strokeWidth+2/d)):(this.hitContext.globalAlpha=0,this.hitContext.lineWidth=1)},drawPoint:function(a,b,c){if(!1!==b.graphic)if(b.externalGraphic)this.drawExternalGraphic(a,b,c);else if(b.graphicName&&"circle"!=b.graphicName)this.drawNamedSymbol(a,b,c);else{var d=this.getLocalXY(a),a=d[0],d=d[1];if(!isNaN(a)&&!isNaN(d)){var e=2*Math.PI,f=b.pointRadius;!1!==b.fill&&(this.setCanvasStyle("fill",b),this.canvas.beginPath(),this.canvas.arc(a,d,f,0,e,!0),this.canvas.fill(),this.hitDetection&&(this.setHitContextStyle("fill",c,b),this.hitContext.beginPath(),this.hitContext.arc(a,d,f,0,e,!0),this.hitContext.fill()));!1!==b.stroke&&(this.setCanvasStyle("stroke",b),this.canvas.beginPath(),this.canvas.arc(a,d,f,0,e,!0),this.canvas.stroke(),this.hitDetection&&(this.setHitContextStyle("stroke",c,b),this.hitContext.beginPath(),this.hitContext.arc(a,d,f,0,e,!0),this.hitContext.stroke()),this.setCanvasStyle("reset"))}}},drawLineString:function(a,b,c){b=OpenLayers.Util.applyDefaults({fill:!1},b);this.drawLinearRing(a,b,c)},drawLinearRing:function(a,b,c){!1!==b.fill&&(this.setCanvasStyle("fill",b),this.renderPath(this.canvas,a,b,c,"fill"),this.hitDetection&&(this.setHitContextStyle("fill",c,b),this.renderPath(this.hitContext,a,b,c,"fill")));!1!==b.stroke&&(this.setCanvasStyle("stroke",b),this.renderPath(this.canvas,a,b,c,"stroke"),this.hitDetection&&(this.setHitContextStyle("stroke",c,b),this.renderPath(this.hitContext,a,b,c,"stroke")));this.setCanvasStyle("reset")},renderPath:function(a,b,c,d,e){b=b.components;c=b.length;a.beginPath();var d=this.getLocalXY(b[0]),f=d[1];if(!isNaN(d[0])&&!isNaN(f)){a.moveTo(d[0],d[1]);for(d=1;d<c;++d)f=this.getLocalXY(b[d]),a.lineTo(f[0],f[1]);"fill"===e?a.fill():a.stroke()}},drawPolygon:function(a,b,c){var a=a.components,d=a.length;this.drawLinearRing(a[0],b,c);for(var e=1;e<d;++e)this.canvas.globalCompositeOperation="destination-out",this.hitDetection&&(this.hitContext.globalCompositeOperation="destination-out"),this.drawLinearRing(a[e],OpenLayers.Util.applyDefaults({stroke:!1,fillOpacity:1},b),c),this.canvas.globalCompositeOperation="source-over",this.hitDetection&&(this.hitContext.globalCompositeOperation="source-over"),this.drawLinearRing(a[e],OpenLayers.Util.applyDefaults({fill:!1},b),c)},drawText:function(a,b){var c=this.getLocalXY(a);this.setCanvasStyle("reset");this.canvas.fillStyle=b.fontColor;this.canvas.globalAlpha=b.fontOpacity||1;var d=[b.fontStyle?b.fontStyle:"normal","normal",b.fontWeight?b.fontWeight:"normal",b.fontSize?b.fontSize:"1em",b.fontFamily?b.fontFamily:"sans-serif"].join(" "),e=b.label.split("\n"),f=e.length;if(this.canvas.fillText){this.canvas.font=d;this.canvas.textAlign=OpenLayers.Renderer.Canvas.LABEL_ALIGN[b.labelAlign[0]]||"center";this.canvas.textBaseline=OpenLayers.Renderer.Canvas.LABEL_ALIGN[b.labelAlign[1]]||"middle";var g=OpenLayers.Renderer.Canvas.LABEL_FACTOR[b.labelAlign[1]];null==g&&(g=-.5);d=this.canvas.measureText("Mg").height||this.canvas.measureText("xx").width;c[1]+=d*g*(f-1);for(g=0;g<f;g++)b.labelOutlineWidth&&(this.canvas.save(),this.canvas.strokeStyle=b.labelOutlineColor,this.canvas.lineWidth=b.labelOutlineWidth,this.canvas.strokeText(e[g],c[0],c[1]+d*g+1),this.canvas.restore()),this.canvas.fillText(e[g],c[0],c[1]+d*g)}else if(this.canvas.mozDrawText){this.canvas.mozTextStyle=d;var h=OpenLayers.Renderer.Canvas.LABEL_FACTOR[b.labelAlign[0]];null==h&&(h=-.5);g=OpenLayers.Renderer.Canvas.LABEL_FACTOR[b.labelAlign[1]];null==g&&(g=-.5);d=this.canvas.mozMeasureText("xx");c[1]+=d*(1+g*f);for(g=0;g<f;g++){var i=c[0]+h*this.canvas.mozMeasureText(e[g]),j=c[1]+g*d;this.canvas.translate(i,j);this.canvas.mozDrawText(e[g]);this.canvas.translate(-i,-j)}}this.setCanvasStyle("reset")},getLocalXY:function(a){var b=this.getResolution(),c=this.extent;return[(a.x-this.featureDx)/b+-c.left/b,c.top/b-a.y/b]},clear:function(){var a=this.root.height,b=this.root.width;this.canvas.clearRect(0,0,b,a);this.features={};this.hitDetection&&this.hitContext.clearRect(0,0,b,a)},getFeatureIdFromEvent:function(a){var b;if(this.hitDetection&&"none"!==this.root.style.display&&!this.map.dragging&&(a=a.xy,a=this.hitContext.getImageData(a.x|0,a.y|0,1,1).data,255===a[3]&&(a=a[2]+256*(a[1]+256*a[0])))){a="OpenLayers.Feature.Vector_"+(a-1+this.hitOverflow);try{b=this.features[a][0]}catch(c){}}return b},eraseFeatures:function(a){OpenLayers.Util.isArray(a)||(a=[a]);for(var b=0;b<a.length;++b)delete this.features[a[b].id];this.redraw()},redraw:function(){if(!this.locked){var a=this.root.height,b=this.root.width;this.canvas.clearRect(0,0,b,a);this.hitDetection&&this.hitContext.clearRect(0,0,b,a);var a=[],c,d,e=this.map.baseLayer&&this.map.baseLayer.wrapDateLine&&this.map.getMaxExtent(),f;for(f in this.features)this.features.hasOwnProperty(f)&&(b=this.features[f][0],c=b.geometry,this.calculateFeatureDx(c.getBounds(),e),d=this.features[f][1],this.drawGeometry(c,d,b.id),d.label&&a.push([b,d]));b=0;for(c=a.length;b<c;++b)f=a[b],this.drawText(f[0].geometry.getCentroid(),f[1])}},CLASS_NAME:"OpenLayers.Renderer.Canvas"});OpenLayers.Renderer.Canvas.LABEL_ALIGN={l:"left",r:"right",t:"top",b:"bottom"};OpenLayers.Renderer.Canvas.LABEL_FACTOR={l:0,r:-1,t:0,b:-1};OpenLayers.Renderer.Canvas.drawImageScaleFactor=null;OpenLayers.Format.OSM=OpenLayers.Class(OpenLayers.Format.XML,{checkTags:!1,interestingTagsExclude:null,areaTags:null,initialize:function(a){for(var b={interestingTagsExclude:"source source_ref source:ref history attribution created_by".split(" "),areaTags:"area building leisure tourism ruins historic landuse military natural sport".split(" ")},b=OpenLayers.Util.extend(b,a),c={},a=0;a<b.interestingTagsExclude.length;a++)c[b.interestingTagsExclude[a]]=!0;b.interestingTagsExclude=c;c={};for(a=0;a<b.areaTags.length;a++)c[b.areaTags[a]]=!0;b.areaTags=c;this.externalProjection=new OpenLayers.Projection("EPSG:4326");OpenLayers.Format.XML.prototype.initialize.apply(this,[b])},read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));for(var b=this.getNodes(a),c=this.getWays(a),a=Array(c.length),d=0;d<c.length;d++){for(var e=Array(c[d].nodes.length),f=this.isWayArea(c[d])?1:0,g=0;g<c[d].nodes.length;g++){var h=b[c[d].nodes[g]],i=new OpenLayers.Geometry.Point(h.lon,h.lat);i.osm_id=parseInt(c[d].nodes[g]);e[g]=i;h.used=!0}h=null;h=f?new OpenLayers.Geometry.Polygon(new OpenLayers.Geometry.LinearRing(e)):new OpenLayers.Geometry.LineString(e);this.internalProjection&&this.externalProjection&&h.transform(this.externalProjection,this.internalProjection);e=new OpenLayers.Feature.Vector(h,c[d].tags);e.osm_id=parseInt(c[d].id);e.fid="way."+e.osm_id;a[d]=e}for(var j in b){h=b[j];if(!h.used||this.checkTags){c=null;if(this.checkTags){c=this.getTags(h.node,!0);if(h.used&&!c[1])continue;c=c[0]}else c=this.getTags(h.node);e=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(h.lon,h.lat),c);this.internalProjection&&this.externalProjection&&e.geometry.transform(this.externalProjection,this.internalProjection);e.osm_id=parseInt(j);e.fid="node."+e.osm_id;a.push(e)}h.node=null}return a},getNodes:function(a){for(var a=a.getElementsByTagName("node"),b={},c=0;c<a.length;c++){var d=a[c],e=d.getAttribute("id");b[e]={lat:d.getAttribute("lat"),lon:d.getAttribute("lon"),node:d}}return b},getWays:function(a){for(var a=a.getElementsByTagName("way"),b=[],c=0;c<a.length;c++){var d=a[c],e={id:d.getAttribute("id")};e.tags=this.getTags(d);d=d.getElementsByTagName("nd");e.nodes=Array(d.length);for(var f=0;f<d.length;f++)e.nodes[f]=d[f].getAttribute("ref");b.push(e)}return b},getTags:function(a,b){for(var c=a.getElementsByTagName("tag"),d={},e=!1,f=0;f<c.length;f++){var g=c[f].getAttribute("k");d[g]=c[f].getAttribute("v");b&&(this.interestingTagsExclude[g]||(e=!0))}return b?[d,e]:d},isWayArea:function(a){var b=!1,c=!1;a.nodes[0]==a.nodes[a.nodes.length-1]&&(b=!0);if(this.checkTags)for(var d in a.tags)if(this.areaTags[d]){c=!0;break}return b&&(this.checkTags?c:!0)},write:function(a){OpenLayers.Util.isArray(a)||(a=[a]);this.osm_id=1;this.created_nodes={};var b=this.createElementNS(null,"osm");b.setAttribute("version","0.5");b.setAttribute("generator","OpenLayers "+OpenLayers.VERSION_NUMBER);for(var c=a.length-1;0<=c;c--)for(var d=this.createFeatureNodes(a[c]),e=0;e<d.length;e++)b.appendChild(d[e]);return OpenLayers.Format.XML.prototype.write.apply(this,[b])},createFeatureNodes:function(a){var b=[],c=a.geometry.CLASS_NAME,c=c.substring(c.lastIndexOf(".")+1),c=c.toLowerCase();(c=this.createXML[c])&&(b=c.apply(this,[a]));return b},createXML:{point:function(a){var b=null,c=a.geometry?a.geometry:a;this.internalProjection&&this.externalProjection&&(c=c.clone(),c.transform(this.internalProjection,this.externalProjection));var d=!1;a.osm_id?(b=a.osm_id,this.created_nodes[b]&&(d=!0)):(b=-this.osm_id,this.osm_id++);var e=d?this.created_nodes[b]:this.createElementNS(null,"node");this.created_nodes[b]=e;e.setAttribute("id",b);e.setAttribute("lon",c.x);e.setAttribute("lat",c.y);a.attributes&&this.serializeTags(a,e);this.setState(a,e);return d?[]:[e]},linestring:function(a){var b,c=[],d=a.geometry;a.osm_id?b=a.osm_id:(b=-this.osm_id,this.osm_id++);var e=this.createElementNS(null,"way");e.setAttribute("id",b);for(b=0;b<d.components.length;b++){var f=this.createXML.point.apply(this,[d.components[b]]);if(f.length){var f=f[0],g=f.getAttribute("id");c.push(f)}else g=d.components[b].osm_id,f=this.created_nodes[g];this.setState(a,f);f=this.createElementNS(null,"nd");f.setAttribute("ref",g);e.appendChild(f)}this.serializeTags(a,e);c.push(e);return c},polygon:function(a){var b=OpenLayers.Util.extend({area:"yes"},a.attributes),b=new OpenLayers.Feature.Vector(a.geometry.components[0],b);b.osm_id=a.osm_id;return this.createXML.linestring.apply(this,[b])}},serializeTags:function(a,b){for(var c in a.attributes){var d=this.createElementNS(null,"tag");d.setAttribute("k",c);d.setAttribute("v",a.attributes[c]);b.appendChild(d)}},setState:function(a,b){if(a.state){var c=null;switch(a.state){case OpenLayers.State.UPDATE:case OpenLayers.State.DELETE:c="delete"}c&&b.setAttribute("action",c)}},CLASS_NAME:"OpenLayers.Format.OSM"});OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:!1,evt:null,initialize:function(a,b,c){OpenLayers.Util.extend(this,c);this.control=a;this.callbacks=b;(a=this.map||a.map)&&this.setMap(a);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},setMap:function(a){this.map=a},checkModifiers:function(a){return null==this.keyMask?!0:((a.shiftKey?OpenLayers.Handler.MOD_SHIFT:0)|(a.ctrlKey?OpenLayers.Handler.MOD_CTRL:0)|(a.altKey?OpenLayers.Handler.MOD_ALT:0))==this.keyMask},activate:function(){if(this.active)return!1;for(var a=OpenLayers.Events.prototype.BROWSER_EVENTS,b=0,c=a.length;b<c;b++)this[a[b]]&&this.register(a[b],this[a[b]]);return this.active=!0},deactivate:function(){if(!this.active)return!1;for(var a=OpenLayers.Events.prototype.BROWSER_EVENTS,b=0,c=a.length;b<c;b++)this[a[b]]&&this.unregister(a[b],this[a[b]]);this.active=!1;return!0},callback:function(a,b){a&&this.callbacks[a]&&this.callbacks[a].apply(this.control,b)},register:function(a,b){this.map.events.registerPriority(a,this,b);this.map.events.registerPriority(a,this,this.setEvent)},unregister:function(a,b){this.map.events.unregister(a,this,b);this.map.events.unregister(a,this,this.setEvent)},setEvent:function(a){this.evt=a;return!0},destroy:function(){this.deactivate();this.control=this.map=null},CLASS_NAME:"OpenLayers.Handler"});OpenLayers.Handler.MOD_NONE=0;OpenLayers.Handler.MOD_SHIFT=1;OpenLayers.Handler.MOD_CTRL=2;OpenLayers.Handler.MOD_ALT=4;OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:!1,stopDown:!0,dragging:!1,touch:!1,last:null,start:null,lastMoveEvt:null,oldOnselectstart:null,interval:0,timeoutId:null,documentDrag:!1,documentEvents:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(!0===this.documentDrag){var d=this;this._docMove=function(a){d.mousemove({xy:{x:a.clientX,y:a.clientY},element:document})};this._docUp=function(a){d.mouseup({xy:{x:a.clientX,y:a.clientY}})}}},dragstart:function(a){var b=!0;this.dragging=!1;this.checkModifiers(a)&&(OpenLayers.Event.isLeftClick(a)||OpenLayers.Event.isSingleTouch(a))?(this.started=!0,this.last=this.start=a.xy,OpenLayers.Element.addClass(this.map.viewPortDiv,"olDragDown"),this.down(a),this.callback("down",[a.xy]),OpenLayers.Event.stop(a),this.oldOnselectstart||(this.oldOnselectstart=document.onselectstart?document.onselectstart:OpenLayers.Function.True),document.onselectstart=OpenLayers.Function.False,b=!this.stopDown):(this.started=!1,this.last=this.start=null);return b},dragmove:function(a){this.lastMoveEvt=a;if(this.started&&!this.timeoutId&&(a.xy.x!=this.last.x||a.xy.y!=this.last.y))!0===this.documentDrag&&this.documentEvents&&(a.element===document?(this.adjustXY(a),this.setEvent(a)):this.removeDocumentEvents()),0<this.interval&&(this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval)),this.dragging=!0,this.move(a),this.callback("move",[a.xy]),this.oldOnselectstart||(this.oldOnselectstart=document.onselectstart,document.onselectstart=OpenLayers.Function.False),this.last=a.xy;return!0},dragend:function(a){if(this.started){!0===this.documentDrag&&this.documentEvents&&(this.adjustXY(a),this.removeDocumentEvents());var b=this.start!=this.last;this.dragging=this.started=!1;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(a);this.callback("up",[a.xy]);b&&this.callback("done",[a.xy]);document.onselectstart=this.oldOnselectstart}return!0},down:function(){},move:function(){},up:function(){},out:function(){},mousedown:function(a){return this.dragstart(a)},touchstart:function(a){this.touch||(this.touch=!0,this.map.events.un({mousedown:this.mousedown,mouseup:this.mouseup,mousemove:this.mousemove,click:this.click,scope:this}));return this.dragstart(a)},mousemove:function(a){return this.dragmove(a)},touchmove:function(a){return this.dragmove(a)},removeTimeout:function(){this.timeoutId=null;this.dragging&&this.mousemove(this.lastMoveEvt)},mouseup:function(a){return this.dragend(a)},touchend:function(a){a.xy=this.last;return this.dragend(a)},mouseout:function(a){if(this.started&&OpenLayers.Util.mouseLeft(a,this.map.viewPortDiv))if(!0===this.documentDrag)this.addDocumentEvents();else{var b=this.start!=this.last;this.dragging=this.started=!1;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.out(a);this.callback("out",[]);b&&this.callback("done",[a.xy]);document.onselectstart&&(document.onselectstart=this.oldOnselectstart)}return!0},click:function(){return this.start==this.last},activate:function(){var a=!1;OpenLayers.Handler.prototype.activate.apply(this,arguments)&&(this.dragging=!1,a=!0);return a},deactivate:function(){var a=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.dragging=this.started=this.touch=!1,this.last=this.start=null,a=!0,OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown"));return a},adjustXY:function(a){var b=OpenLayers.Util.pagePosition(this.map.viewPortDiv);a.xy.x-=b[0];a.xy.y-=b[1]},addDocumentEvents:function(){OpenLayers.Element.addClass(document.body,"olDragDown");this.documentEvents=!0;OpenLayers.Event.observe(document,"mousemove",this._docMove);OpenLayers.Event.observe(document,"mouseup",this._docUp)},removeDocumentEvents:function(){OpenLayers.Element.removeClass(document.body,"olDragDown");this.documentEvents=!1;OpenLayers.Event.stopObserving(document,"mousemove",this._docMove);OpenLayers.Event.stopObserving(document,"mouseup",this._docUp)},CLASS_NAME:"OpenLayers.Handler.Drag"});OpenLayers.Handler.Feature=OpenLayers.Class(OpenLayers.Handler,{EVENTMAP:{click:{"in":"click",out:"clickout"},mousemove:{"in":"over",out:"out"},dblclick:{"in":"dblclick",out:null},mousedown:{"in":null,out:null},mouseup:{"in":null,out:null},touchstart:{"in":"click",out:"clickout"}},feature:null,lastFeature:null,down:null,up:null,touch:!1,clickTolerance:4,geometryTypes:null,stopClick:!0,stopDown:!0,stopUp:!1,initialize:function(a,b,c,d){OpenLayers.Handler.prototype.initialize.apply(this,[a,c,d]);this.layer=b},touchstart:function(a){this.touch||(this.touch=!0,this.map.events.un({mousedown:this.mousedown,mouseup:this.mouseup,mousemove:this.mousemove,click:this.click,dblclick:this.dblclick,scope:this}));return OpenLayers.Event.isMultiTouch(a)?!0:this.mousedown(a)},touchmove:function(a){OpenLayers.Event.stop(a)},mousedown:function(a){if(OpenLayers.Event.isLeftClick(a)||OpenLayers.Event.isSingleTouch(a))this.down=a.xy;return this.handle(a)?!this.stopDown:!0},mouseup:function(a){this.up=a.xy;return this.handle(a)?!this.stopUp:!0},click:function(a){return this.handle(a)?!this.stopClick:!0},mousemove:function(a){if(!this.callbacks.over&&!this.callbacks.out)return!0;this.handle(a);return!0},dblclick:function(a){return!this.handle(a)},geometryTypeMatches:function(a){return null==this.geometryTypes||-1<OpenLayers.Util.indexOf(this.geometryTypes,a.geometry.CLASS_NAME)},handle:function(a){this.feature&&!this.feature.layer&&(this.feature=null);var b=a.type,c=!1,d=!!this.feature,e="click"==b||"dblclick"==b||"touchstart"==b;if((this.feature=this.layer.getFeatureFromEvent(a))&&!this.feature.layer)this.feature=null;this.lastFeature&&!this.lastFeature.layer&&(this.lastFeature=null);this.feature?("touchstart"===b&&OpenLayers.Event.stop(a),a=this.feature!=this.lastFeature,this.geometryTypeMatches(this.feature)?(d&&a?(this.lastFeature&&this.triggerCallback(b,"out",[this.lastFeature]),this.triggerCallback(b,"in",[this.feature])):(!d||e)&&this.triggerCallback(b,"in",[this.feature]),this.lastFeature=this.feature,c=!0):(this.lastFeature&&(d&&a||e)&&this.triggerCallback(b,"out",[this.lastFeature]),this.feature=null)):this.lastFeature&&(d||e)&&this.triggerCallback(b,"out",[this.lastFeature]);return c},triggerCallback:function(a,b,c){(b=this.EVENTMAP[a][b])&&("click"==a&&this.up&&this.down?Math.sqrt(Math.pow(this.up.x-this.down.x,2)+Math.pow(this.up.y-this.down.y,2))<=this.clickTolerance&&this.callback(b,c):this.callback(b,c))},activate:function(){var a=!1;OpenLayers.Handler.prototype.activate.apply(this,arguments)&&(this.moveLayerToTop(),this.map.events.on({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this}),a=!0);return a},deactivate:function(){var a=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.moveLayerBack(),this.up=this.down=this.lastFeature=this.feature=null,this.touch=!1,this.map.events.un({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this}),a=!0);return a},handleMapEvents:function(a){("removelayer"==a.type||"order"==a.property)&&this.moveLayerToTop()},moveLayerToTop:function(){this.layer.setZIndex(Math.max(this.map.Z_INDEX_BASE.Feature-1,this.layer.getZIndex())+1)},moveLayerBack:function(){var a=this.layer.getZIndex()-1;a>=this.map.Z_INDEX_BASE.Feature?this.layer.setZIndex(a):this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer))},CLASS_NAME:"OpenLayers.Handler.Feature"});OpenLayers.Control.DragFeature=OpenLayers.Class(OpenLayers.Control,{geometryTypes:null,onStart:function(){},onDrag:function(){},onComplete:function(){},onEnter:function(){},onLeave:function(){},documentDrag:!1,layer:null,feature:null,dragCallbacks:{},featureCallbacks:{},lastPixel:null,initialize:function(a,b){OpenLayers.Control.prototype.initialize.apply(this,[b]);this.layer=a;this.handlers={drag:new OpenLayers.Handler.Drag(this,OpenLayers.Util.extend({down:this.downFeature,move:this.moveFeature,up:this.upFeature,out:this.cancel,done:this.doneDragging},this.dragCallbacks),{documentDrag:this.documentDrag}),feature:new OpenLayers.Handler.Feature(this,this.layer,OpenLayers.Util.extend({click:this.clickFeature,clickout:this.clickoutFeature,over:this.overFeature,out:this.outFeature},this.featureCallbacks),{geometryTypes:this.geometryTypes})}},clickFeature:function(a){this.handlers.feature.touch&&(!this.over&&this.overFeature(a))&&(this.handlers.drag.dragstart(this.handlers.feature.evt),this.handlers.drag.stopDown=!1)},clickoutFeature:function(a){this.handlers.feature.touch&&this.over&&(this.outFeature(a),this.handlers.drag.stopDown=!0)},destroy:function(){this.layer=null;
OpenLayers.Control.prototype.destroy.apply(this,[])},activate:function(){return this.handlers.feature.activate()&&OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){this.handlers.drag.deactivate();this.handlers.feature.deactivate();this.feature=null;this.dragging=!1;this.lastPixel=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass+"Over");return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},overFeature:function(a){var b=!1;this.handlers.drag.dragging?this.over=this.feature.id==a.id?!0:!1:(this.feature=a,this.handlers.drag.activate(),this.over=b=!0,OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass+"Over"),this.onEnter(a));return b},downFeature:function(a){this.lastPixel=a;this.onStart(this.feature,a)},moveFeature:function(a){var b=this.map.getResolution();this.feature.geometry.move(b*(a.x-this.lastPixel.x),b*(this.lastPixel.y-a.y));this.layer.drawFeature(this.feature);this.lastPixel=a;this.onDrag(this.feature,a)},upFeature:function(){this.over||this.handlers.drag.deactivate()},doneDragging:function(a){this.onComplete(this.feature,a)},outFeature:function(a){this.handlers.drag.dragging?this.feature.id==a.id&&(this.over=!1):(this.over=!1,this.handlers.drag.deactivate(),OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass+"Over"),this.onLeave(a),this.feature=null)},cancel:function(){this.handlers.drag.deactivate();this.over=!1},setMap:function(a){this.handlers.drag.setMap(a);this.handlers.feature.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,arguments)},CLASS_NAME:"OpenLayers.Control.DragFeature"});OpenLayers.StyleMap=OpenLayers.Class({styles:null,extendDefault:!0,initialize:function(a,b){this.styles={"default":new OpenLayers.Style(OpenLayers.Feature.Vector.style["default"]),select:new OpenLayers.Style(OpenLayers.Feature.Vector.style.select),temporary:new OpenLayers.Style(OpenLayers.Feature.Vector.style.temporary),"delete":new OpenLayers.Style(OpenLayers.Feature.Vector.style["delete"])};if(a instanceof OpenLayers.Style)this.styles["default"]=a,this.styles.select=a,this.styles.temporary=a,this.styles["delete"]=a;else if("object"==typeof a)for(var c in a)if(a[c]instanceof OpenLayers.Style)this.styles[c]=a[c];else if("object"==typeof a[c])this.styles[c]=new OpenLayers.Style(a[c]);else{this.styles["default"]=new OpenLayers.Style(a);this.styles.select=new OpenLayers.Style(a);this.styles.temporary=new OpenLayers.Style(a);this.styles["delete"]=new OpenLayers.Style(a);break}OpenLayers.Util.extend(this,b)},destroy:function(){for(var a in this.styles)this.styles[a].destroy();this.styles=null},createSymbolizer:function(a,b){a||(a=new OpenLayers.Feature.Vector);this.styles[b]||(b="default");a.renderIntent=b;var c={};this.extendDefault&&"default"!=b&&(c=this.styles["default"].createSymbolizer(a));return OpenLayers.Util.extend(c,this.styles[b].createSymbolizer(a))},addUniqueValueRules:function(a,b,c,d){var e=[],f;for(f in c)e.push(new OpenLayers.Rule({symbolizer:c[f],context:d,filter:new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:b,value:f})}));this.styles[a].addRules(e)},CLASS_NAME:"OpenLayers.StyleMap"});OpenLayers.Layer.Vector=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:!1,isFixed:!1,features:null,filter:null,selectedFeatures:null,unrenderedFeatures:null,reportError:!0,style:null,styleMap:null,strategies:null,protocol:null,renderers:["SVG","VML","Canvas"],renderer:null,rendererOptions:null,geometryType:null,drawn:!1,ratio:1,initialize:function(a,b){OpenLayers.Layer.prototype.initialize.apply(this,arguments);(!this.renderer||!this.renderer.supported())&&this.assignRenderer();if(!this.renderer||!this.renderer.supported())this.renderer=null,this.displayError();this.styleMap||(this.styleMap=new OpenLayers.StyleMap);this.features=[];this.selectedFeatures=[];this.unrenderedFeatures={};if(this.strategies)for(var c=0,d=this.strategies.length;c<d;c++)this.strategies[c].setLayer(this)},destroy:function(){if(this.strategies){var a,b,c;b=0;for(c=this.strategies.length;b<c;b++)a=this.strategies[b],a.autoDestroy&&a.destroy();this.strategies=null}this.protocol&&(this.protocol.autoDestroy&&this.protocol.destroy(),this.protocol=null);this.destroyFeatures();this.unrenderedFeatures=this.selectedFeatures=this.features=null;this.renderer&&this.renderer.destroy();this.drawn=this.geometryType=this.renderer=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){null==a&&(a=new OpenLayers.Layer.Vector(this.name,this.getOptions()));for(var a=OpenLayers.Layer.prototype.clone.apply(this,[a]),b=this.features,c=b.length,d=Array(c),e=0;e<c;++e)d[e]=b[e].clone();a.features=d;return a},refresh:function(a){this.calculateInRange()&&this.visibility&&this.events.triggerEvent("refresh",a)},assignRenderer:function(){for(var a=0,b=this.renderers.length;a<b;a++){var c=this.renderers[a];if((c="function"==typeof c?c:OpenLayers.Renderer[c])&&c.prototype.supported()){this.renderer=new c(this.div,this.rendererOptions);break}}},displayError:function(){this.reportError&&OpenLayers.Console.userError(OpenLayers.i18n("browserNotSupported",{renderers:this.renderers.join("\n")}))},setMap:function(a){OpenLayers.Layer.prototype.setMap.apply(this,arguments);if(this.renderer){this.renderer.map=this.map;var b=this.map.getSize();b.w*=this.ratio;b.h*=this.ratio;this.renderer.setSize(b)}else this.map.removeLayer(this)},afterAdd:function(){if(this.strategies){var a,b,c;b=0;for(c=this.strategies.length;b<c;b++)a=this.strategies[b],a.autoActivate&&a.activate()}},removeMap:function(){this.drawn=!1;if(this.strategies){var a,b,c;b=0;for(c=this.strategies.length;b<c;b++)a=this.strategies[b],a.autoActivate&&a.deactivate()}},onMapResize:function(){OpenLayers.Layer.prototype.onMapResize.apply(this,arguments);var a=this.map.getSize();a.w*=this.ratio;a.h*=this.ratio;this.renderer.setSize(a)},moveTo:function(a,b,c){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var d=!0;if(!c){this.renderer.root.style.visibility="hidden";var d=this.map.getSize(),e=d.w,d=d.h,e=e/2*this.ratio-e/2,d=d/2*this.ratio-d/2,e=e+parseInt(this.map.layerContainerDiv.style.left,10),e=-Math.round(e),d=d+parseInt(this.map.layerContainerDiv.style.top,10),d=-Math.round(d);this.div.style.left=e+"px";this.div.style.top=d+"px";d=this.renderer.setExtent(this.map.getExtent().scale(this.ratio),b);this.renderer.root.style.visibility="visible";!0===OpenLayers.IS_GECKO&&(this.div.scrollLeft=this.div.scrollLeft);if(!b&&d)for(var f in this.unrenderedFeatures)e=this.unrenderedFeatures[f],this.drawFeature(e)}if(!this.drawn||b||!d){this.drawn=!0;f=0;for(d=this.features.length;f<d;f++)this.renderer.locked=f!==d-1,e=this.features[f],this.drawFeature(e)}},display:function(a){OpenLayers.Layer.prototype.display.apply(this,arguments);var b=this.div.style.display;b!=this.renderer.root.style.display&&(this.renderer.root.style.display=b)},addFeatures:function(a,b){OpenLayers.Util.isArray(a)||(a=[a]);var c=!b||!b.silent;if(c){var d={features:a};if(!1===this.events.triggerEvent("beforefeaturesadded",d))return;a=d.features}for(var d=[],e=0,f=a.length;e<f;e++){this.renderer.locked=e!=a.length-1?!0:!1;var g=a[e];if(this.geometryType&&!(g.geometry instanceof this.geometryType))throw new TypeError("addFeatures: component should be an "+this.geometryType.prototype.CLASS_NAME);g.layer=this;!g.style&&this.style&&(g.style=OpenLayers.Util.extend({},this.style));if(c){if(!1===this.events.triggerEvent("beforefeatureadded",{feature:g}))continue;this.preFeatureInsert(g)}d.push(g);this.features.push(g);this.drawFeature(g);c&&(this.events.triggerEvent("featureadded",{feature:g}),this.onFeatureInsert(g))}c&&this.events.triggerEvent("featuresadded",{features:d})},removeFeatures:function(a,b){if(a&&0!==a.length){if(a===this.features)return this.removeAllFeatures(b);OpenLayers.Util.isArray(a)||(a=[a]);a===this.selectedFeatures&&(a=a.slice());var c=!b||!b.silent;c&&this.events.triggerEvent("beforefeaturesremoved",{features:a});for(var d=a.length-1;0<=d;d--){this.renderer.locked=0!=d&&a[d-1].geometry?!0:!1;var e=a[d];delete this.unrenderedFeatures[e.id];c&&this.events.triggerEvent("beforefeatureremoved",{feature:e});this.features=OpenLayers.Util.removeItem(this.features,e);e.layer=null;e.geometry&&this.renderer.eraseFeatures(e);-1!=OpenLayers.Util.indexOf(this.selectedFeatures,e)&&OpenLayers.Util.removeItem(this.selectedFeatures,e);c&&this.events.triggerEvent("featureremoved",{feature:e})}c&&this.events.triggerEvent("featuresremoved",{features:a})}},removeAllFeatures:function(a){var a=!a||!a.silent,b=this.features;a&&this.events.triggerEvent("beforefeaturesremoved",{features:b});for(var c,d=b.length-1;0<=d;d--)c=b[d],a&&this.events.triggerEvent("beforefeatureremoved",{feature:c}),c.layer=null,a&&this.events.triggerEvent("featureremoved",{feature:c});this.renderer.clear();this.features=[];this.unrenderedFeatures={};this.selectedFeatures=[];a&&this.events.triggerEvent("featuresremoved",{features:b})},destroyFeatures:function(a,b){void 0==a&&(a=this.features);if(a){this.removeFeatures(a,b);for(var c=a.length-1;0<=c;c--)a[c].destroy()}},drawFeature:function(a,b){if(this.drawn){if("object"!=typeof b){!b&&a.state===OpenLayers.State.DELETE&&(b="delete");var c=b||a.renderIntent;(b=a.style||this.style)||(b=this.styleMap.createSymbolizer(a,c))}c=this.renderer.drawFeature(a,b);!1===c||null===c?this.unrenderedFeatures[a.id]=a:delete this.unrenderedFeatures[a.id]}},eraseFeatures:function(a){this.renderer.eraseFeatures(a)},getFeatureFromEvent:function(a){if(!this.renderer)throw Error("getFeatureFromEvent called on layer with no renderer. This usually means you destroyed a layer, but not some handler which is associated with it.");var b=null;(a=this.renderer.getFeatureIdFromEvent(a))&&(b="string"===typeof a?this.getFeatureById(a):a);return b},getFeatureBy:function(a,b){for(var c=null,d=0,e=this.features.length;d<e;++d)if(this.features[d][a]==b){c=this.features[d];break}return c},getFeatureById:function(a){return this.getFeatureBy("id",a)},getFeatureByFid:function(a){return this.getFeatureBy("fid",a)},getFeaturesByAttribute:function(a,b){var c,d,e=this.features.length,f=[];for(c=0;c<e;c++)(d=this.features[c])&&d.attributes&&d.attributes[a]===b&&f.push(d);return f},onFeatureInsert:function(){},preFeatureInsert:function(){},getDataExtent:function(){var a=null,b=this.features;if(b&&0<b.length)for(var c=null,d=0,e=b.length;d<e;d++)if(c=b[d].geometry)null===a&&(a=new OpenLayers.Bounds),a.extend(c.getBounds());return a},CLASS_NAME:"OpenLayers.Layer.Vector"});OpenLayers.Layer.Vector.RootContainer=OpenLayers.Class(OpenLayers.Layer.Vector,{displayInLayerSwitcher:!1,layers:null,display:function(){},getFeatureFromEvent:function(a){for(var b=this.layers,c,d=0;d<b.length;d++)if(c=b[d].getFeatureFromEvent(a))return c},setMap:function(a){OpenLayers.Layer.Vector.prototype.setMap.apply(this,arguments);this.collectRoots();a.events.register("changelayer",this,this.handleChangeLayer)},removeMap:function(a){a.events.unregister("changelayer",this,this.handleChangeLayer);this.resetRoots();OpenLayers.Layer.Vector.prototype.removeMap.apply(this,arguments)},collectRoots:function(){for(var a,b=0;b<this.map.layers.length;++b)a=this.map.layers[b],-1!=OpenLayers.Util.indexOf(this.layers,a)&&a.renderer.moveRoot(this.renderer)},resetRoots:function(){for(var a,b=0;b<this.layers.length;++b)a=this.layers[b],this.renderer&&a.renderer.getRenderLayerId()==this.id&&this.renderer.moveRoot(a.renderer)},handleChangeLayer:function(a){var b=a.layer;"order"==a.property&&-1!=OpenLayers.Util.indexOf(this.layers,b)&&(this.resetRoots(),this.collectRoots())},CLASS_NAME:"OpenLayers.Layer.Vector.RootContainer"});OpenLayers.Control.SelectFeature=OpenLayers.Class(OpenLayers.Control,{multipleKey:null,toggleKey:null,multiple:!1,clickout:!0,toggle:!1,hover:!1,highlightOnly:!1,box:!1,onBeforeSelect:function(){},onSelect:function(){},onUnselect:function(){},scope:null,geometryTypes:null,layer:null,layers:null,callbacks:null,selectStyle:null,renderIntent:"select",handlers:null,initialize:function(a,b){OpenLayers.Control.prototype.initialize.apply(this,[b]);null===this.scope&&(this.scope=this);this.initLayer(a);var c={click:this.clickFeature,clickout:this.clickoutFeature};this.hover&&(c.over=this.overFeature,c.out=this.outFeature);this.callbacks=OpenLayers.Util.extend(c,this.callbacks);this.handlers={feature:new OpenLayers.Handler.Feature(this,this.layer,this.callbacks,{geometryTypes:this.geometryTypes})};this.box&&(this.handlers.box=new OpenLayers.Handler.Box(this,{done:this.selectBox},{boxDivClassName:"olHandlerBoxSelectFeature"}))},initLayer:function(a){OpenLayers.Util.isArray(a)?(this.layers=a,this.layer=new OpenLayers.Layer.Vector.RootContainer(this.id+"_container",{layers:a})):this.layer=a},destroy:function(){this.active&&this.layers&&this.map.removeLayer(this.layer);OpenLayers.Control.prototype.destroy.apply(this,arguments);this.layers&&this.layer.destroy()},activate:function(){this.active||(this.layers&&this.map.addLayer(this.layer),this.handlers.feature.activate(),this.box&&this.handlers.box&&this.handlers.box.activate());return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){this.active&&(this.handlers.feature.deactivate(),this.handlers.box&&this.handlers.box.deactivate(),this.layers&&this.map.removeLayer(this.layer));return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},unselectAll:function(a){for(var b=this.layers||[this.layer],c,d,e=0;e<b.length;++e){c=b[e];for(var f=c.selectedFeatures.length-1;0<=f;--f)d=c.selectedFeatures[f],(!a||a.except!=d)&&this.unselect(d)}},clickFeature:function(a){this.hover||(-1<OpenLayers.Util.indexOf(a.layer.selectedFeatures,a)?this.toggleSelect()?this.unselect(a):this.multipleSelect()||this.unselectAll({except:a}):(this.multipleSelect()||this.unselectAll({except:a}),this.select(a)))},multipleSelect:function(){return this.multiple||this.handlers.feature.evt&&this.handlers.feature.evt[this.multipleKey]},toggleSelect:function(){return this.toggle||this.handlers.feature.evt&&this.handlers.feature.evt[this.toggleKey]},clickoutFeature:function(){!this.hover&&this.clickout&&this.unselectAll()},overFeature:function(a){var b=a.layer;this.hover&&(this.highlightOnly?this.highlight(a):-1==OpenLayers.Util.indexOf(b.selectedFeatures,a)&&this.select(a))},outFeature:function(a){if(this.hover)if(this.highlightOnly){if(a._lastHighlighter==this.id)if(a._prevHighlighter&&a._prevHighlighter!=this.id){delete a._lastHighlighter;var b=this.map.getControl(a._prevHighlighter);b&&b.highlight(a)}else this.unhighlight(a)}else this.unselect(a)},highlight:function(a){var b=a.layer;!1!==this.events.triggerEvent("beforefeaturehighlighted",{feature:a})&&(a._prevHighlighter=a._lastHighlighter,a._lastHighlighter=this.id,b.drawFeature(a,this.selectStyle||this.renderIntent),this.events.triggerEvent("featurehighlighted",{feature:a}))},unhighlight:function(a){var b=a.layer;void 0==a._prevHighlighter?delete a._lastHighlighter:(a._prevHighlighter!=this.id&&(a._lastHighlighter=a._prevHighlighter),delete a._prevHighlighter);b.drawFeature(a,a.style||a.layer.style||"default");this.events.triggerEvent("featureunhighlighted",{feature:a})},select:function(a){var b=this.onBeforeSelect.call(this.scope,a),c=a.layer;!1!==b&&(b=c.events.triggerEvent("beforefeatureselected",{feature:a}),!1!==b&&(c.selectedFeatures.push(a),this.highlight(a),this.handlers.feature.lastFeature||(this.handlers.feature.lastFeature=c.selectedFeatures[0]),c.events.triggerEvent("featureselected",{feature:a}),this.onSelect.call(this.scope,a)))},unselect:function(a){var b=a.layer;this.unhighlight(a);OpenLayers.Util.removeItem(b.selectedFeatures,a);b.events.triggerEvent("featureunselected",{feature:a});this.onUnselect.call(this.scope,a)},selectBox:function(a){if(a instanceof OpenLayers.Bounds){var b=this.map.getLonLatFromPixel({x:a.left,y:a.bottom}),a=this.map.getLonLatFromPixel({x:a.right,y:a.top}),b=new OpenLayers.Bounds(b.lon,b.lat,a.lon,a.lat);this.multipleSelect()||this.unselectAll();a=this.multiple;this.multiple=!0;var c=this.layers||[this.layer];this.events.triggerEvent("boxselectionstart",{layers:c});for(var d,e=0;e<c.length;++e){d=c[e];for(var f=0,g=d.features.length;f<g;++f){var h=d.features[f];h.getVisibility()&&(null==this.geometryTypes||-1<OpenLayers.Util.indexOf(this.geometryTypes,h.geometry.CLASS_NAME))&&b.toGeometry().intersects(h.geometry)&&-1==OpenLayers.Util.indexOf(d.selectedFeatures,h)&&this.select(h)}}this.multiple=a;this.events.triggerEvent("boxselectionend",{layers:c})}},setMap:function(a){this.handlers.feature.setMap(a);this.box&&this.handlers.box.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,arguments)},setLayer:function(a){var b=this.active;this.unselectAll();this.deactivate();this.layers&&(this.layer.destroy(),this.layers=null);this.initLayer(a);this.handlers.feature.layer=this.layer;b&&this.activate()},CLASS_NAME:"OpenLayers.Control.SelectFeature"});OpenLayers.Handler.Keyboard=OpenLayers.Class(OpenLayers.Handler,{KEY_EVENTS:["keydown","keyup"],eventListener:null,observeElement:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.eventListener=OpenLayers.Function.bindAsEventListener(this.handleKeyEvent,this)},destroy:function(){this.deactivate();this.eventListener=null;OpenLayers.Handler.prototype.destroy.apply(this,arguments)},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.observeElement=this.observeElement||document;for(var a=0,b=this.KEY_EVENTS.length;a<b;a++)OpenLayers.Event.observe(this.observeElement,this.KEY_EVENTS[a],this.eventListener);return!0}return!1},deactivate:function(){var a=!1;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){for(var a=0,b=this.KEY_EVENTS.length;a<b;a++)OpenLayers.Event.stopObserving(this.observeElement,this.KEY_EVENTS[a],this.eventListener);a=!0}return a},handleKeyEvent:function(a){this.checkModifiers(a)&&this.callback(a.type,[a])},CLASS_NAME:"OpenLayers.Handler.Keyboard"});OpenLayers.Control.ModifyFeature=OpenLayers.Class(OpenLayers.Control,{geometryTypes:null,clickout:!0,toggle:!0,standalone:!1,layer:null,feature:null,vertices:null,virtualVertices:null,selectControl:null,dragControl:null,handlers:null,deleteCodes:null,virtualStyle:null,vertexRenderIntent:null,mode:null,createVertices:!0,modified:!1,radiusHandle:null,dragHandle:null,onModificationStart:function(){},onModification:function(){},onModificationEnd:function(){},initialize:function(a,b){b=b||{};this.layer=a;this.vertices=[];this.virtualVertices=[];this.virtualStyle=OpenLayers.Util.extend({},this.layer.style||this.layer.styleMap.createSymbolizer(null,b.vertexRenderIntent));this.virtualStyle.fillOpacity=.3;this.virtualStyle.strokeOpacity=.3;this.deleteCodes=[46,68];this.mode=OpenLayers.Control.ModifyFeature.RESHAPE;OpenLayers.Control.prototype.initialize.apply(this,[b]);OpenLayers.Util.isArray(this.deleteCodes)||(this.deleteCodes=[this.deleteCodes]);var c=this,d={geometryTypes:this.geometryTypes,clickout:this.clickout,toggle:this.toggle,onBeforeSelect:this.beforeSelectFeature,onSelect:this.selectFeature,onUnselect:this.unselectFeature,scope:this};!1===this.standalone&&(this.selectControl=new OpenLayers.Control.SelectFeature(a,d));this.dragControl=new OpenLayers.Control.DragFeature(a,{geometryTypes:["OpenLayers.Geometry.Point"],onStart:function(a,b){c.dragStart.apply(c,[a,b])},onDrag:function(a,b){c.dragVertex.apply(c,[a,b])},onComplete:function(a){c.dragComplete.apply(c,[a])},featureCallbacks:{over:function(a){(c.standalone!==true||a._sketch||c.feature===a)&&c.dragControl.overFeature.apply(c.dragControl,[a])}}});this.handlers={keyboard:new OpenLayers.Handler.Keyboard(this,{keydown:this.handleKeypress})}},destroy:function(){this.layer=null;this.standalone||this.selectControl.destroy();this.dragControl.destroy();OpenLayers.Control.prototype.destroy.apply(this,[])},activate:function(){return(this.standalone||this.selectControl.activate())&&this.handlers.keyboard.activate()&&OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){var a=!1;if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){this.layer.removeFeatures(this.vertices,{silent:!0});this.layer.removeFeatures(this.virtualVertices,{silent:!0});this.vertices=[];this.dragControl.deactivate();var b=(a=this.feature)&&a.geometry&&a.layer;!1===this.standalone?(b&&this.selectControl.unselect.apply(this.selectControl,[a]),this.selectControl.deactivate()):b&&this.unselectFeature(a);this.handlers.keyboard.deactivate();a=!0}return a},beforeSelectFeature:function(a){return this.layer.events.triggerEvent("beforefeaturemodified",{feature:a})},selectFeature:function(a){if(!this.standalone||!1!==this.beforeSelectFeature(a))this.feature=a,this.modified=!1,this.resetVertices(),this.dragControl.activate(),this.onModificationStart(this.feature);var b=a.modified;if(a.geometry&&(!b||!b.geometry))this._originalGeometry=a.geometry.clone()},unselectFeature:function(a){this.layer.removeFeatures(this.vertices,{silent:!0});this.vertices=[];this.layer.destroyFeatures(this.virtualVertices,{silent:!0});this.virtualVertices=[];this.dragHandle&&(this.layer.destroyFeatures([this.dragHandle],{silent:!0}),delete this.dragHandle);this.radiusHandle&&(this.layer.destroyFeatures([this.radiusHandle],{silent:!0}),delete this.radiusHandle);this.feature=null;this.dragControl.deactivate();this.onModificationEnd(a);this.layer.events.triggerEvent("afterfeaturemodified",{feature:a,modified:this.modified});this.modified=!1},dragStart:function(a,b){if(a!=this.feature&&(!a.geometry.parent&&a!=this.dragHandle&&a!=this.radiusHandle)&&(!1===this.standalone&&this.feature&&this.selectControl.clickFeature.apply(this.selectControl,[this.feature]),null==this.geometryTypes||-1!=OpenLayers.Util.indexOf(this.geometryTypes,a.geometry.CLASS_NAME)))this.standalone||this.selectControl.clickFeature.apply(this.selectControl,[a]),this.dragControl.overFeature.apply(this.dragControl,[a]),this.dragControl.lastPixel=b,this.dragControl.handlers.drag.started=!0,this.dragControl.handlers.drag.start=b,this.dragControl.handlers.drag.last=b},dragVertex:function(a,b){this.modified=!0;"OpenLayers.Geometry.Point"==this.feature.geometry.CLASS_NAME?(this.feature!=a&&(this.feature=a),this.layer.events.triggerEvent("vertexmodified",{vertex:a.geometry,feature:this.feature,pixel:b})):(a._index?(a.geometry.parent.addComponent(a.geometry,a._index),delete a._index,OpenLayers.Util.removeItem(this.virtualVertices,a),this.vertices.push(a)):a==this.dragHandle?(this.layer.removeFeatures(this.vertices,{silent:!0}),this.vertices=[],this.radiusHandle&&(this.layer.destroyFeatures([this.radiusHandle],{silent:!0}),this.radiusHandle=null)):a!==this.radiusHandle&&this.layer.events.triggerEvent("vertexmodified",{vertex:a.geometry,feature:this.feature,pixel:b}),0<this.virtualVertices.length&&(this.layer.destroyFeatures(this.virtualVertices,{silent:!0}),this.virtualVertices=[]),this.layer.drawFeature(this.feature,this.standalone?void 0:this.selectControl.renderIntent));this.layer.drawFeature(a)},dragComplete:function(){this.resetVertices();this.setFeatureState();this.onModification(this.feature);this.layer.events.triggerEvent("featuremodified",{feature:this.feature})},setFeatureState:function(){if(this.feature.state!=OpenLayers.State.INSERT&&this.feature.state!=OpenLayers.State.DELETE&&(this.feature.state=OpenLayers.State.UPDATE,this.modified&&this._originalGeometry)){var a=this.feature;a.modified=OpenLayers.Util.extend(a.modified,{geometry:this._originalGeometry});delete this._originalGeometry}},resetVertices:function(){this.dragControl.feature&&this.dragControl.outFeature(this.dragControl.feature);0<this.vertices.length&&(this.layer.removeFeatures(this.vertices,{silent:!0}),this.vertices=[]);0<this.virtualVertices.length&&(this.layer.removeFeatures(this.virtualVertices,{silent:!0}),this.virtualVertices=[]);this.dragHandle&&(this.layer.destroyFeatures([this.dragHandle],{silent:!0}),this.dragHandle=null);this.radiusHandle&&(this.layer.destroyFeatures([this.radiusHandle],{silent:!0}),this.radiusHandle=null);this.feature&&"OpenLayers.Geometry.Point"!=this.feature.geometry.CLASS_NAME&&(this.mode&OpenLayers.Control.ModifyFeature.DRAG&&this.collectDragHandle(),this.mode&(OpenLayers.Control.ModifyFeature.ROTATE|OpenLayers.Control.ModifyFeature.RESIZE)&&this.collectRadiusHandle(),this.mode&OpenLayers.Control.ModifyFeature.RESHAPE&&(this.mode&OpenLayers.Control.ModifyFeature.RESIZE||this.collectVertices()))},handleKeypress:function(a){var b=a.keyCode;if(this.feature&&-1!=OpenLayers.Util.indexOf(this.deleteCodes,b)&&(b=this.dragControl.feature)&&-1!=OpenLayers.Util.indexOf(this.vertices,b)&&!this.dragControl.handlers.drag.dragging&&b.geometry.parent)b.geometry.parent.removeComponent(b.geometry),this.layer.events.triggerEvent("vertexremoved",{vertex:b.geometry,feature:this.feature,pixel:a.xy}),this.layer.drawFeature(this.feature,this.standalone?void 0:this.selectControl.renderIntent),this.modified=!0,this.resetVertices(),this.setFeatureState(),this.onModification(this.feature),this.layer.events.triggerEvent("featuremodified",{feature:this.feature})},collectVertices:function(){function a(c){var d,e,f;if("OpenLayers.Geometry.Point"==c.CLASS_NAME)e=new OpenLayers.Feature.Vector(c),e._sketch=!0,e.renderIntent=b.vertexRenderIntent,b.vertices.push(e);else{f=c.components.length;"OpenLayers.Geometry.LinearRing"==c.CLASS_NAME&&(f-=1);for(d=0;d<f;++d)e=c.components[d],"OpenLayers.Geometry.Point"==e.CLASS_NAME?(e=new OpenLayers.Feature.Vector(e),e._sketch=!0,e.renderIntent=b.vertexRenderIntent,b.vertices.push(e)):a(e);if(b.createVertices&&"OpenLayers.Geometry.MultiPoint"!=c.CLASS_NAME){d=0;for(f=c.components.length;d<f-1;++d){e=c.components[d];var g=c.components[d+1];"OpenLayers.Geometry.Point"==e.CLASS_NAME&&"OpenLayers.Geometry.Point"==g.CLASS_NAME&&(e=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point((e.x+g.x)/2,(e.y+g.y)/2),null,b.virtualStyle),e.geometry.parent=c,e._index=d+1,e._sketch=!0,b.virtualVertices.push(e))}}}}this.vertices=[];this.virtualVertices=[];var b=this;a.call(this,this.feature.geometry);this.layer.addFeatures(this.virtualVertices,{silent:!0});this.layer.addFeatures(this.vertices,{silent:!0})},collectDragHandle:function(){var a=this.feature.geometry,b=a.getBounds().getCenterLonLat(),b=new OpenLayers.Geometry.Point(b.lon,b.lat),c=new OpenLayers.Feature.Vector(b);b.move=function(b,c){OpenLayers.Geometry.Point.prototype.move.call(this,b,c);a.move(b,c)};c._sketch=!0;this.dragHandle=c;this.dragHandle.renderIntent=this.vertexRenderIntent;this.layer.addFeatures([this.dragHandle],{silent:!0})},collectRadiusHandle:function(){var a=this.feature.geometry,b=a.getBounds(),c=b.getCenterLonLat(),d=new OpenLayers.Geometry.Point(c.lon,c.lat),b=new OpenLayers.Geometry.Point(b.right,b.bottom),c=new OpenLayers.Feature.Vector(b),e=this.mode&OpenLayers.Control.ModifyFeature.RESIZE,f=this.mode&OpenLayers.Control.ModifyFeature.RESHAPE,g=this.mode&OpenLayers.Control.ModifyFeature.ROTATE;b.move=function(b,c){OpenLayers.Geometry.Point.prototype.move.call(this,b,c);var j=this.x-d.x,k=this.y-d.y,l=j-b,m=k-c;if(g){var n=Math.atan2(m,l),n=Math.atan2(k,j)-n,n=n*(180/Math.PI);a.rotate(n,d)}if(e){var o;f?(k/=m,o=j/l/k):(l=Math.sqrt(l*l+m*m),k=Math.sqrt(j*j+k*k)/l);a.resize(k,d,o)}};c._sketch=!0;this.radiusHandle=c;this.radiusHandle.renderIntent=this.vertexRenderIntent;this.layer.addFeatures([this.radiusHandle],{silent:!0})},setMap:function(a){this.standalone||this.selectControl.setMap(a);this.dragControl.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,arguments)},CLASS_NAME:"OpenLayers.Control.ModifyFeature"});OpenLayers.Control.ModifyFeature.RESHAPE=1;OpenLayers.Control.ModifyFeature.RESIZE=2;OpenLayers.Control.ModifyFeature.ROTATE=4;OpenLayers.Control.ModifyFeature.DRAG=8;OpenLayers.Layer.Bing=OpenLayers.Class(OpenLayers.Layer.XYZ,{key:null,serverResolutions:[156543.03390625,78271.516953125,39135.7584765625,19567.87923828125,9783.939619140625,4891.9698095703125,2445.9849047851562,1222.9924523925781,611.4962261962891,305.74811309814453,152.87405654907226,76.43702827453613,38.218514137268066,19.109257068634033,9.554628534317017,4.777314267158508,2.388657133579254,1.194328566789627,.5971642833948135,.29858214169740677,.14929107084870338,.07464553542435169],attributionTemplate:'<span class="olBingAttribution ${type}"><div><a target="_blank" href="http://www.bing.com/maps/"><img src="${logo}" /></a></div>${copyrights}<a style="white-space: nowrap" target="_blank" href="http://www.microsoft.com/maps/product/terms.html">Terms of Use</a></span>',metadata:null,type:"Road",culture:"en-US",metadataParams:null,tileOptions:null,initialize:function(a){a=OpenLayers.Util.applyDefaults({sphericalMercator:!0},a);OpenLayers.Layer.XYZ.prototype.initialize.apply(this,[a.name||"Bing "+(a.type||this.type),null,a]);this.tileOptions=OpenLayers.Util.extend({crossOriginKeyword:"anonymous"},this.options.tileOptions);this.loadMetadata()},loadMetadata:function(){this._callbackId="_callback_"+this.id.replace(/\./g,"_");window[this._callbackId]=OpenLayers.Function.bind(OpenLayers.Layer.Bing.processMetadata,this);var a=OpenLayers.Util.applyDefaults({key:this.key,jsonp:this._callbackId,include:"ImageryProviders"},this.metadataParams),a="http://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.type+"?"+OpenLayers.Util.getParameterString(a),b=document.createElement("script");b.type="text/javascript";b.src=a;b.id=this._callbackId;document.getElementsByTagName("head")[0].appendChild(b)},initLayer:function(){var a=this.metadata.resourceSets[0].resources[0],b=a.imageUrl.replace("{quadkey}","${quadkey}"),b=b.replace("{culture}",this.culture);this.url=[];for(var c=0;c<a.imageUrlSubdomains.length;++c)this.url.push(b.replace("{subdomain}",a.imageUrlSubdomains[c]));this.addOptions({maxResolution:Math.min(this.serverResolutions[a.zoomMin],this.maxResolution||Number.POSITIVE_INFINITY),numZoomLevels:Math.min(a.zoomMax+1-a.zoomMin,this.numZoomLevels)},!0)},getURL:function(a){if(this.url){for(var b=this.getXYZ(a),a=b.x,c=b.y,b=b.z,d=[],e=b;0<e;--e){var f="0",g=1<<e-1;0!=(a&g)&&f++;0!=(c&g)&&(f++,f++);d.push(f)}d=d.join("");a=this.selectUrl(""+a+c+b,this.url);return OpenLayers.String.format(a,{quadkey:d})}},updateAttribution:function(){var a=this.metadata;if(a.resourceSets&&this.map&&this.map.center){var b=a.resourceSets[0].resources[0],c=this.map.getExtent().transform(this.map.getProjectionObject(),new OpenLayers.Projection("EPSG:4326")),b=b.imageryProviders,d=OpenLayers.Util.indexOf(this.serverResolutions,this.getServerResolution()),e="",f,g,h,i,j,k,l;g=0;for(h=b.length;g<h;++g){f=b[g];i=0;for(j=f.coverageAreas.length;i<j;++i)l=f.coverageAreas[i],k=OpenLayers.Bounds.fromArray(l.bbox,!0),c.intersectsBounds(k)&&(d<=l.zoomMax&&d>=l.zoomMin)&&(e+=f.attribution+" ")}this.attribution=OpenLayers.String.format(this.attributionTemplate,{type:this.type.toLowerCase(),logo:a.brandLogoUri,copyrights:e});this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"attribution"})}},setMap:function(){OpenLayers.Layer.XYZ.prototype.setMap.apply(this,arguments);this.updateAttribution();this.map.events.register("moveend",this,this.updateAttribution)},clone:function(a){null==a&&(a=new OpenLayers.Layer.Bing(this.options));return a=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[a])},destroy:function(){this.map&&this.map.events.unregister("moveend",this,this.updateAttribution);OpenLayers.Layer.XYZ.prototype.destroy.apply(this,arguments)},CLASS_NAME:"OpenLayers.Layer.Bing"});OpenLayers.Layer.Bing.processMetadata=function(a){this.metadata=a;this.initLayer();a=document.getElementById(this._callbackId);a.parentNode.removeChild(a);window[this._callbackId]=void 0;delete this._callbackId};OpenLayers.Layer.PointGrid=OpenLayers.Class(OpenLayers.Layer.Vector,{dx:null,dy:null,ratio:1.5,maxFeatures:250,rotation:0,origin:null,gridBounds:null,initialize:function(a){a=a||{};OpenLayers.Layer.Vector.prototype.initialize.apply(this,[a.name,a]);
},setMap:function(a){OpenLayers.Layer.Vector.prototype.setMap.apply(this,arguments);a.events.register("moveend",this,this.onMoveEnd)},removeMap:function(a){a.events.unregister("moveend",this,this.onMoveEnd);OpenLayers.Layer.Vector.prototype.removeMap.apply(this,arguments)},setRatio:function(a){this.ratio=a;this.updateGrid(!0)},setMaxFeatures:function(a){this.maxFeatures=a;this.updateGrid(!0)},setSpacing:function(a,b){this.dx=a;this.dy=b||a;this.updateGrid(!0)},setOrigin:function(a){this.origin=a;this.updateGrid(!0)},getOrigin:function(){this.origin||(this.origin=this.map.getExtent().getCenterLonLat());return this.origin},setRotation:function(a){this.rotation=a;this.updateGrid(!0)},onMoveEnd:function(){this.updateGrid()},getViewBounds:function(){var a=this.map.getExtent();if(this.rotation){var b=this.getOrigin(),b=new OpenLayers.Geometry.Point(b.lon,b.lat),a=a.toGeometry();a.rotate(-this.rotation,b);a=a.getBounds()}return a},updateGrid:function(a){if(a||this.invalidBounds()){var b=this.getViewBounds(),c=this.getOrigin(),a=new OpenLayers.Geometry.Point(c.lon,c.lat),d=b.getWidth(),e=b.getHeight(),f=d/e,g=Math.sqrt(this.dx*this.dy*this.maxFeatures/f),d=Math.min(d*this.ratio,g*f),e=Math.min(e*this.ratio,g),b=b.getCenterLonLat();this.gridBounds=new OpenLayers.Bounds(b.lon-d/2,b.lat-e/2,b.lon+d/2,b.lat+e/2);for(var b=Math.floor(e/this.dy),d=Math.floor(d/this.dx),e=c.lon+this.dx*Math.ceil((this.gridBounds.left-c.lon)/this.dx),c=c.lat+this.dy*Math.ceil((this.gridBounds.bottom-c.lat)/this.dy),g=Array(b*d),h,i=0;i<d;++i)for(var f=e+i*this.dx,j=0;j<b;++j)h=c+j*this.dy,h=new OpenLayers.Geometry.Point(f,h),this.rotation&&h.rotate(this.rotation,a),g[i*b+j]=new OpenLayers.Feature.Vector(h);this.destroyFeatures(this.features,{silent:!0});this.addFeatures(g,{silent:!0})}},invalidBounds:function(){return!this.gridBounds||!this.gridBounds.containsBounds(this.getViewBounds())},CLASS_NAME:"OpenLayers.Layer.PointGrid"});OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,interval:0,delta:0,cumulative:!0,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.wheelListener=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this)},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);this.wheelListener=null},onWheelEvent:function(a){if(this.map&&this.checkModifiers(a)){for(var b=!1,c=!1,d=!1,e=OpenLayers.Event.element(a);null!=e&&!d&&!b;){if(!b)try{var f=e.currentStyle?e.currentStyle.overflow:document.defaultView.getComputedStyle(e,null).getPropertyValue("overflow"),b=f&&"auto"==f||"scroll"==f}catch(g){}if(!c)for(var d=0,h=this.map.layers.length;d<h;d++)if(e==this.map.layers[d].div||e==this.map.layers[d].pane){c=!0;break}d=e==this.map.div;e=e.parentNode}!b&&d&&(c&&((b=0,a||(a=window.event),a.wheelDelta?(b=a.wheelDelta/120,window.opera&&9.2>window.opera.version()&&(b=-b)):a.detail&&(b=-a.detail/3),this.delta+=b,this.interval)?(window.clearTimeout(this._timeoutId),this._timeoutId=window.setTimeout(OpenLayers.Function.bind(function(){this.wheelZoom(a)},this),this.interval)):this.wheelZoom(a)),OpenLayers.Event.stop(a))}},wheelZoom:function(a){var b=this.delta;this.delta=0;b&&(this.mousePosition&&(a.xy=this.mousePosition),a.xy||(a.xy=this.map.getPixelFromLonLat(this.map.getCenter())),0>b?this.callback("down",[a,this.cumulative?b:-1]):this.callback("up",[a,this.cumulative?b:1]))},mousemove:function(a){this.mousePosition=a.xy},activate:function(a){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var b=this.wheelListener;OpenLayers.Event.observe(window,"DOMMouseScroll",b);OpenLayers.Event.observe(window,"mousewheel",b);OpenLayers.Event.observe(document,"mousewheel",b);return!0}return!1},deactivate:function(a){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){var b=this.wheelListener;OpenLayers.Event.stopObserving(window,"DOMMouseScroll",b);OpenLayers.Event.stopObserving(window,"mousewheel",b);OpenLayers.Event.stopObserving(document,"mousewheel",b);return!0}return!1},CLASS_NAME:"OpenLayers.Handler.MouseWheel"});OpenLayers.Symbolizer=OpenLayers.Class({zIndex:0,initialize:function(a){OpenLayers.Util.extend(this,a)},clone:function(){return new(eval(this.CLASS_NAME))(OpenLayers.Util.extend({},this))},CLASS_NAME:"OpenLayers.Symbolizer"});OpenLayers.Symbolizer.Raster=OpenLayers.Class(OpenLayers.Symbolizer,{initialize:function(a){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Symbolizer.Raster"});OpenLayers.Rule=OpenLayers.Class({id:null,name:null,title:null,description:null,context:null,filter:null,elseFilter:!1,symbolizer:null,symbolizers:null,minScaleDenominator:null,maxScaleDenominator:null,initialize:function(a){this.symbolizer={};OpenLayers.Util.extend(this,a);this.symbolizers&&delete this.symbolizer;this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){for(var a in this.symbolizer)this.symbolizer[a]=null;this.symbolizer=null;delete this.symbolizers},evaluate:function(a){var b=this.getContext(a),c=!0;if(this.minScaleDenominator||this.maxScaleDenominator)var d=a.layer.map.getScale();this.minScaleDenominator&&(c=d>=OpenLayers.Style.createLiteral(this.minScaleDenominator,b));c&&this.maxScaleDenominator&&(c=d<OpenLayers.Style.createLiteral(this.maxScaleDenominator,b));c&&this.filter&&(c="OpenLayers.Filter.FeatureId"==this.filter.CLASS_NAME?this.filter.evaluate(a):this.filter.evaluate(b));return c},getContext:function(a){var b=this.context;b||(b=a.attributes||a.data);"function"==typeof this.context&&(b=this.context(a));return b},clone:function(){var a=OpenLayers.Util.extend({},this);if(this.symbolizers){var b=this.symbolizers.length;a.symbolizers=Array(b);for(var c=0;c<b;++c)a.symbolizers[c]=this.symbolizers[c].clone()}else{a.symbolizer={};for(var d in this.symbolizer)b=this.symbolizer[d],c=typeof b,"object"===c?a.symbolizer[d]=OpenLayers.Util.extend({},b):"string"===c&&(a.symbolizer[d]=b)}a.filter=this.filter&&this.filter.clone();a.context=this.context&&OpenLayers.Util.extend({},this.context);return new OpenLayers.Rule(a)},CLASS_NAME:"OpenLayers.Rule"});OpenLayers.Filter.Spatial=OpenLayers.Class(OpenLayers.Filter,{type:null,property:null,value:null,distance:null,distanceUnits:null,evaluate:function(a){var b=!1;switch(this.type){case OpenLayers.Filter.Spatial.BBOX:case OpenLayers.Filter.Spatial.INTERSECTS:if(a.geometry){var c=this.value;"OpenLayers.Bounds"==this.value.CLASS_NAME&&(c=this.value.toGeometry());a.geometry.intersects(c)&&(b=!0)}break;default:throw Error("evaluate is not implemented for this filter type.")}return b},clone:function(){var a=OpenLayers.Util.applyDefaults({value:this.value&&this.value.clone&&this.value.clone()},this);return new OpenLayers.Filter.Spatial(a)},CLASS_NAME:"OpenLayers.Filter.Spatial"});OpenLayers.Filter.Spatial.BBOX="BBOX";OpenLayers.Filter.Spatial.INTERSECTS="INTERSECTS";OpenLayers.Filter.Spatial.DWITHIN="DWITHIN";OpenLayers.Filter.Spatial.WITHIN="WITHIN";OpenLayers.Filter.Spatial.CONTAINS="CONTAINS";OpenLayers.Format.SLD=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{profile:null,defaultVersion:"1.0.0",stringifyOutput:!0,namedLayersAsArray:!1,CLASS_NAME:"OpenLayers.Format.SLD"});OpenLayers.Symbolizer.Polygon=OpenLayers.Class(OpenLayers.Symbolizer,{initialize:function(a){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Symbolizer.Polygon"});OpenLayers.Format.GML.v2=OpenLayers.Class(OpenLayers.Format.GML.Base,{schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd",initialize:function(a){OpenLayers.Format.GML.Base.prototype.initialize.apply(this,[a])},readers:{gml:OpenLayers.Util.applyDefaults({outerBoundaryIs:function(a,b){var c={};this.readChildNodes(a,c);b.outer=c.components[0]},innerBoundaryIs:function(a,b){var c={};this.readChildNodes(a,c);b.inner.push(c.components[0])},Box:function(a,b){var c={};this.readChildNodes(a,c);b.components||(b.components=[]);var d=c.points[0],c=c.points[1];b.components.push(new OpenLayers.Bounds(d.x,d.y,c.x,c.y))}},OpenLayers.Format.GML.Base.prototype.readers.gml),feature:OpenLayers.Format.GML.Base.prototype.readers.feature,wfs:OpenLayers.Format.GML.Base.prototype.readers.wfs},write:function(a){a=this.writeNode(OpenLayers.Util.isArray(a)?"wfs:FeatureCollection":"gml:featureMember",a);this.setAttributeNS(a,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[a])},writers:{gml:OpenLayers.Util.applyDefaults({Point:function(a){var b=this.createElementNSPlus("gml:Point");this.writeNode("coordinates",[a],b);return b},coordinates:function(a){for(var b=a.length,c=Array(b),d,e=0;e<b;++e)d=a[e],c[e]=this.xy?d.x+","+d.y:d.y+","+d.x,void 0!=d.z&&(c[e]+=","+d.z);return this.createElementNSPlus("gml:coordinates",{attributes:{decimal:".",cs:",",ts:" "},value:1==b?c[0]:c.join(" ")})},LineString:function(a){var b=this.createElementNSPlus("gml:LineString");this.writeNode("coordinates",a.components,b);return b},Polygon:function(a){var b=this.createElementNSPlus("gml:Polygon");this.writeNode("outerBoundaryIs",a.components[0],b);for(var c=1;c<a.components.length;++c)this.writeNode("innerBoundaryIs",a.components[c],b);return b},outerBoundaryIs:function(a){var b=this.createElementNSPlus("gml:outerBoundaryIs");this.writeNode("LinearRing",a,b);return b},innerBoundaryIs:function(a){var b=this.createElementNSPlus("gml:innerBoundaryIs");this.writeNode("LinearRing",a,b);return b},LinearRing:function(a){var b=this.createElementNSPlus("gml:LinearRing");this.writeNode("coordinates",a.components,b);return b},Box:function(a){var b=this.createElementNSPlus("gml:Box");this.writeNode("coordinates",[{x:a.left,y:a.bottom},{x:a.right,y:a.top}],b);this.srsName&&b.setAttribute("srsName",this.srsName);return b}},OpenLayers.Format.GML.Base.prototype.writers.gml),feature:OpenLayers.Format.GML.Base.prototype.writers.feature,wfs:OpenLayers.Format.GML.Base.prototype.writers.wfs},CLASS_NAME:"OpenLayers.Format.GML.v2"});OpenLayers.Format.Filter.v1_0_0=OpenLayers.Class(OpenLayers.Format.GML.v2,OpenLayers.Format.Filter.v1,{VERSION:"1.0.0",schemaLocation:"http://www.opengis.net/ogc/filter/1.0.0/filter.xsd",initialize:function(a){OpenLayers.Format.GML.v2.prototype.initialize.apply(this,[a])},readers:{ogc:OpenLayers.Util.applyDefaults({PropertyIsEqualTo:function(a,b){var c=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO});this.readChildNodes(a,c);b.filters.push(c)},PropertyIsNotEqualTo:function(a,b){var c=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.NOT_EQUAL_TO});this.readChildNodes(a,c);b.filters.push(c)},PropertyIsLike:function(a,b){var c=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.LIKE});this.readChildNodes(a,c);var d=a.getAttribute("wildCard"),e=a.getAttribute("singleChar"),f=a.getAttribute("escape");c.value2regex(d,e,f);b.filters.push(c)}},OpenLayers.Format.Filter.v1.prototype.readers.ogc),gml:OpenLayers.Format.GML.v2.prototype.readers.gml,feature:OpenLayers.Format.GML.v2.prototype.readers.feature},writers:{ogc:OpenLayers.Util.applyDefaults({PropertyIsEqualTo:function(a){var b=this.createElementNSPlus("ogc:PropertyIsEqualTo");this.writeNode("PropertyName",a,b);this.writeOgcExpression(a.value,b);return b},PropertyIsNotEqualTo:function(a){var b=this.createElementNSPlus("ogc:PropertyIsNotEqualTo");this.writeNode("PropertyName",a,b);this.writeOgcExpression(a.value,b);return b},PropertyIsLike:function(a){var b=this.createElementNSPlus("ogc:PropertyIsLike",{attributes:{wildCard:"*",singleChar:".",escape:"!"}});this.writeNode("PropertyName",a,b);this.writeNode("Literal",a.regex2value(),b);return b},BBOX:function(a){var b=this.createElementNSPlus("ogc:BBOX");a.property&&this.writeNode("PropertyName",a,b);var c=this.writeNode("gml:Box",a.value,b);a.projection&&c.setAttribute("srsName",a.projection);return b}},OpenLayers.Format.Filter.v1.prototype.writers.ogc),gml:OpenLayers.Format.GML.v2.prototype.writers.gml,feature:OpenLayers.Format.GML.v2.prototype.writers.feature},writeSpatial:function(a,b){var c=this.createElementNSPlus("ogc:"+b);this.writeNode("PropertyName",a,c);if(a.value instanceof OpenLayers.Filter.Function)this.writeNode("Function",a.value,c);else{var d;d=a.value instanceof OpenLayers.Geometry?this.writeNode("feature:_geometry",a.value).firstChild:this.writeNode("gml:Box",a.value);a.projection&&d.setAttribute("srsName",a.projection);c.appendChild(d)}return c},CLASS_NAME:"OpenLayers.Format.Filter.v1_0_0"});OpenLayers.Format.WFST.v1_0_0=OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0,OpenLayers.Format.WFST.v1,{version:"1.0.0",srsNameInQuery:!1,schemaLocations:{wfs:"http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"},initialize:function(a){OpenLayers.Format.Filter.v1_0_0.prototype.initialize.apply(this,[a]);OpenLayers.Format.WFST.v1.prototype.initialize.apply(this,[a])},readNode:function(a,b){return OpenLayers.Format.GML.v2.prototype.readNode.apply(this,[a,b])},readers:{wfs:OpenLayers.Util.applyDefaults({WFS_TransactionResponse:function(a,b){b.insertIds=[];b.success=!1;this.readChildNodes(a,b)},InsertResult:function(a,b){var c={fids:[]};this.readChildNodes(a,c);b.insertIds.push(c.fids[0])},TransactionResult:function(a,b){this.readChildNodes(a,b)},Status:function(a,b){this.readChildNodes(a,b)},SUCCESS:function(a,b){b.success=!0}},OpenLayers.Format.WFST.v1.prototype.readers.wfs),gml:OpenLayers.Format.GML.v2.prototype.readers.gml,feature:OpenLayers.Format.GML.v2.prototype.readers.feature,ogc:OpenLayers.Format.Filter.v1_0_0.prototype.readers.ogc},writers:{wfs:OpenLayers.Util.applyDefaults({Query:function(a){var a=OpenLayers.Util.extend({featureNS:this.featureNS,featurePrefix:this.featurePrefix,featureType:this.featureType,srsName:this.srsName,srsNameInQuery:this.srsNameInQuery},a),b=a.featurePrefix,c=this.createElementNSPlus("wfs:Query",{attributes:{typeName:(b?b+":":"")+a.featureType}});a.srsNameInQuery&&a.srsName&&c.setAttribute("srsName",a.srsName);a.featureNS&&c.setAttribute("xmlns:"+b,a.featureNS);if(a.propertyNames)for(var b=0,d=a.propertyNames.length;b<d;b++)this.writeNode("ogc:PropertyName",{property:a.propertyNames[b]},c);a.filter&&(this.setFilterProperty(a.filter),this.writeNode("ogc:Filter",a.filter,c));return c}},OpenLayers.Format.WFST.v1.prototype.writers.wfs),gml:OpenLayers.Format.GML.v2.prototype.writers.gml,feature:OpenLayers.Format.GML.v2.prototype.writers.feature,ogc:OpenLayers.Format.Filter.v1_0_0.prototype.writers.ogc},CLASS_NAME:"OpenLayers.Format.WFST.v1_0_0"});OpenLayers.ElementsIndexer=OpenLayers.Class({maxZIndex:null,order:null,indices:null,compare:null,initialize:function(a){this.compare=a?OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_Y_ORDER:OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_DRAWING_ORDER;this.clear()},insert:function(a){this.exists(a)&&this.remove(a);var b=a.id;this.determineZIndex(a);for(var c=-1,d=this.order.length,e;1<d-c;)e=parseInt((c+d)/2),0<this.compare(this,a,OpenLayers.Util.getElement(this.order[e]))?c=e:d=e;this.order.splice(d,0,b);this.indices[b]=this.getZIndex(a);return this.getNextElement(d)},remove:function(a){var a=a.id,b=OpenLayers.Util.indexOf(this.order,a);0<=b&&(this.order.splice(b,1),delete this.indices[a],this.maxZIndex=0<this.order.length?this.indices[this.order[this.order.length-1]]:0)},clear:function(){this.order=[];this.indices={};this.maxZIndex=0},exists:function(a){return null!=this.indices[a.id]},getZIndex:function(a){return a._style.graphicZIndex},determineZIndex:function(a){var b=a._style.graphicZIndex;null==b?(b=this.maxZIndex,a._style.graphicZIndex=b):b>this.maxZIndex&&(this.maxZIndex=b)},getNextElement:function(a){a+=1;if(a<this.order.length){var b=OpenLayers.Util.getElement(this.order[a]);void 0==b&&(b=this.getNextElement(a));return b}return null},CLASS_NAME:"OpenLayers.ElementsIndexer"});OpenLayers.ElementsIndexer.IndexingMethods={Z_ORDER:function(a,b,c){var b=a.getZIndex(b),d=0;c&&(a=a.getZIndex(c),d=b-a);return d},Z_ORDER_DRAWING_ORDER:function(a,b,c){a=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(a,b,c);c&&0==a&&(a=1);return a},Z_ORDER_Y_ORDER:function(a,b,c){a=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(a,b,c);c&&0===a&&(b=c._boundsBottom-b._boundsBottom,a=0===b?1:b);return a}};OpenLayers.Renderer.Elements=OpenLayers.Class(OpenLayers.Renderer,{rendererRoot:null,root:null,vectorRoot:null,textRoot:null,xmlns:null,xOffset:0,indexer:null,BACKGROUND_ID_SUFFIX:"_background",LABEL_ID_SUFFIX:"_label",LABEL_OUTLINE_SUFFIX:"_outline",initialize:function(a,b){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.rendererRoot=this.createRenderRoot();this.root=this.createRoot("_root");this.vectorRoot=this.createRoot("_vroot");this.textRoot=this.createRoot("_troot");this.root.appendChild(this.vectorRoot);this.root.appendChild(this.textRoot);this.rendererRoot.appendChild(this.root);this.container.appendChild(this.rendererRoot);if(b&&(b.zIndexing||b.yOrdering))this.indexer=new OpenLayers.ElementsIndexer(b.yOrdering)},destroy:function(){this.clear();this.xmlns=this.root=this.rendererRoot=null;OpenLayers.Renderer.prototype.destroy.apply(this,arguments)},clear:function(){var a,b=this.vectorRoot;if(b)for(;a=b.firstChild;)b.removeChild(a);if(b=this.textRoot)for(;a=b.firstChild;)b.removeChild(a);this.indexer&&this.indexer.clear()},setExtent:function(a,b){var c=OpenLayers.Renderer.prototype.setExtent.apply(this,arguments),d=this.getResolution();if(this.map.baseLayer&&this.map.baseLayer.wrapDateLine){var e,f=a.getWidth()/this.map.getExtent().getWidth(),a=a.scale(1/f),f=this.map.getMaxExtent();f.right>a.left&&f.right<a.right?e=!0:f.left>a.left&&f.left<a.right&&(e=!1);if(e!==this.rightOfDateLine||b)c=!1,this.xOffset=!0===e?f.getWidth()/d:0;this.rightOfDateLine=e}return c},getNodeType:function(){},drawGeometry:function(a,b,c){var d=a.CLASS_NAME,e=!0;if("OpenLayers.Geometry.Collection"==d||"OpenLayers.Geometry.MultiPoint"==d||"OpenLayers.Geometry.MultiLineString"==d||"OpenLayers.Geometry.MultiPolygon"==d){for(var d=0,f=a.components.length;d<f;d++)e=this.drawGeometry(a.components[d],b,c)&&e;return e}d=e=!1;"none"!=b.display&&(b.backgroundGraphic?this.redrawBackgroundNode(a.id,a,b,c):d=!0,e=this.redrawNode(a.id,a,b,c));if(!1==e&&(b=document.getElementById(a.id)))b._style.backgroundGraphic&&(d=!0),b.parentNode.removeChild(b);d&&(b=document.getElementById(a.id+this.BACKGROUND_ID_SUFFIX))&&b.parentNode.removeChild(b);return e},redrawNode:function(a,b,c,d){c=this.applyDefaultSymbolizer(c);a=this.nodeFactory(a,this.getNodeType(b,c));a._featureId=d;a._boundsBottom=b.getBounds().bottom;a._geometryClass=b.CLASS_NAME;a._style=c;b=this.drawGeometryNode(a,b,c);if(!1===b)return!1;a=b.node;this.indexer?(c=this.indexer.insert(a))?this.vectorRoot.insertBefore(a,c):this.vectorRoot.appendChild(a):a.parentNode!==this.vectorRoot&&this.vectorRoot.appendChild(a);this.postDraw(a);return b.complete},redrawBackgroundNode:function(a,b,c){c=OpenLayers.Util.extend({},c);c.externalGraphic=c.backgroundGraphic;c.graphicXOffset=c.backgroundXOffset;c.graphicYOffset=c.backgroundYOffset;c.graphicZIndex=c.backgroundGraphicZIndex;c.graphicWidth=c.backgroundWidth||c.graphicWidth;c.graphicHeight=c.backgroundHeight||c.graphicHeight;c.backgroundGraphic=null;c.backgroundXOffset=null;c.backgroundYOffset=null;c.backgroundGraphicZIndex=null;return this.redrawNode(a+this.BACKGROUND_ID_SUFFIX,b,c,null)},drawGeometryNode:function(a,b,c){var c=c||a._style,d={isFilled:void 0===c.fill?!0:c.fill,isStroked:void 0===c.stroke?!!c.strokeWidth:c.stroke},e;switch(b.CLASS_NAME){case"OpenLayers.Geometry.Point":!1===c.graphic&&(d.isFilled=!1,d.isStroked=!1);e=this.drawPoint(a,b);break;case"OpenLayers.Geometry.LineString":d.isFilled=!1;e=this.drawLineString(a,b);break;case"OpenLayers.Geometry.LinearRing":e=this.drawLinearRing(a,b);break;case"OpenLayers.Geometry.Polygon":e=this.drawPolygon(a,b);break;case"OpenLayers.Geometry.Rectangle":e=this.drawRectangle(a,b)}a._options=d;return!1!=e?{node:this.setStyle(a,c,d,b),complete:e}:!1},postDraw:function(){},drawPoint:function(){},drawLineString:function(){},drawLinearRing:function(){},drawPolygon:function(){},drawRectangle:function(){},drawCircle:function(){},removeText:function(a){var b=document.getElementById(a+this.LABEL_ID_SUFFIX);b&&this.textRoot.removeChild(b);(a=document.getElementById(a+this.LABEL_OUTLINE_SUFFIX))&&this.textRoot.removeChild(a)},getFeatureIdFromEvent:function(a){var b=a.target,c=b&&b.correspondingUseElement;return(c?c:b||a.srcElement)._featureId},eraseGeometry:function(a,b){if("OpenLayers.Geometry.MultiPoint"==a.CLASS_NAME||"OpenLayers.Geometry.MultiLineString"==a.CLASS_NAME||"OpenLayers.Geometry.MultiPolygon"==a.CLASS_NAME||"OpenLayers.Geometry.Collection"==a.CLASS_NAME)for(var c=0,d=a.components.length;c<d;c++)this.eraseGeometry(a.components[c],b);else if((c=OpenLayers.Util.getElement(a.id))&&c.parentNode)if(c.geometry&&(c.geometry.destroy(),c.geometry=null),c.parentNode.removeChild(c),this.indexer&&this.indexer.remove(c),c._style.backgroundGraphic)(c=OpenLayers.Util.getElement(a.id+this.BACKGROUND_ID_SUFFIX))&&c.parentNode&&c.parentNode.removeChild(c)},nodeFactory:function(a,b){var c=OpenLayers.Util.getElement(a);c?this.nodeTypeCompare(c,b)||(c.parentNode.removeChild(c),c=this.nodeFactory(a,b)):c=this.createNode(b,a);return c},nodeTypeCompare:function(){},createNode:function(){},moveRoot:function(a){var b=this.root;a.root.parentNode==this.rendererRoot&&(b=a.root);b.parentNode.removeChild(b);a.rendererRoot.appendChild(b)},getRenderLayerId:function(){return this.root.parentNode.parentNode.id},isComplexSymbol:function(a){return"circle"!=a&&!!a},CLASS_NAME:"OpenLayers.Renderer.Elements"});OpenLayers.Control.ArgParser=OpenLayers.Class(OpenLayers.Control,{center:null,zoom:null,layers:null,displayProjection:null,getParameters:function(a){var a=a||window.location.href,b=OpenLayers.Util.getParameters(a),c=a.indexOf("#");0<c&&(a="?"+a.substring(c+1,a.length),OpenLayers.Util.extend(b,OpenLayers.Util.getParameters(a)));return b},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var b=0,c=this.map.controls.length;b<c;b++){var d=this.map.controls[b];if(d!=this&&"OpenLayers.Control.ArgParser"==d.CLASS_NAME){d.displayProjection!=this.displayProjection&&(this.displayProjection=d.displayProjection);break}}if(b==this.map.controls.length&&(b=this.getParameters(),b.layers&&(this.layers=b.layers,this.map.events.register("addlayer",this,this.configureLayers),this.configureLayers()),b.lat&&b.lon))this.center=new OpenLayers.LonLat(parseFloat(b.lon),parseFloat(b.lat)),b.zoom&&(this.zoom=parseFloat(b.zoom)),this.map.events.register("changebaselayer",this,this.setCenter),this.setCenter()},setCenter:function(){this.map.baseLayer&&(this.map.events.unregister("changebaselayer",this,this.setCenter),this.displayProjection&&this.center.transform(this.displayProjection,this.map.getProjectionObject()),this.map.setCenter(this.center,this.zoom))},configureLayers:function(){if(this.layers.length==this.map.layers.length){this.map.events.unregister("addlayer",this,this.configureLayers);for(var a=0,b=this.layers.length;a<b;a++){var c=this.map.layers[a],d=this.layers.charAt(a);"B"==d?this.map.setBaseLayer(c):("T"==d||"F"==d)&&c.setVisibility("T"==d)}}},CLASS_NAME:"OpenLayers.Control.ArgParser"});OpenLayers.Control.Permalink=OpenLayers.Class(OpenLayers.Control,{argParserClass:OpenLayers.Control.ArgParser,element:null,anchor:!1,base:"",displayProjection:null,initialize:function(a,b,c){null!==a&&"object"==typeof a&&!OpenLayers.Util.isElement(a)?(this.base=document.location.href,OpenLayers.Control.prototype.initialize.apply(this,[a]),null!=this.element&&(this.element=OpenLayers.Util.getElement(this.element))):(OpenLayers.Control.prototype.initialize.apply(this,[c]),this.element=OpenLayers.Util.getElement(a),this.base=b||document.location.href)},destroy:function(){this.element&&this.element.parentNode==this.div&&(this.div.removeChild(this.element),this.element=null);this.map&&this.map.events.unregister("moveend",this,this.updateLink);OpenLayers.Control.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var b=0,c=this.map.controls.length;b<c;b++){var d=this.map.controls[b];if(d.CLASS_NAME==this.argParserClass.CLASS_NAME){d.displayProjection!=this.displayProjection&&(this.displayProjection=d.displayProjection);break}}b==this.map.controls.length&&this.map.addControl(new this.argParserClass({displayProjection:this.displayProjection}))},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);!this.element&&!this.anchor&&(this.element=document.createElement("a"),this.element.innerHTML=OpenLayers.i18n("Permalink"),this.element.href="",this.div.appendChild(this.element));this.map.events.on({moveend:this.updateLink,changelayer:this.updateLink,changebaselayer:this.updateLink,scope:this});this.updateLink();return this.div},updateLink:function(){var a=this.anchor?"#":"?",b=this.base;-1!=b.indexOf(a)&&(b=b.substring(0,b.indexOf(a)));b+=a+OpenLayers.Util.getParameterString(this.createParams());this.anchor&&!this.element?window.location.href=b:this.element.href=b},createParams:function(a,b,c){var a=a||this.map.getCenter(),d=OpenLayers.Util.getParameters(this.base);if(a){d.zoom=b||this.map.getZoom();b=a.lat;a=a.lon;this.displayProjection&&(b=OpenLayers.Projection.transform({x:a,y:b},this.map.getProjectionObject(),this.displayProjection),a=b.x,b=b.y);d.lat=Math.round(1e5*b)/1e5;d.lon=Math.round(1e5*a)/1e5;c=c||this.map.layers;d.layers="";a=0;for(b=c.length;a<b;a++){var e=c[a];d.layers=e.isBaseLayer?d.layers+(e==this.map.baseLayer?"B":"0"):d.layers+(e.getVisibility()?"T":"F")}}return d},CLASS_NAME:"OpenLayers.Control.Permalink"});OpenLayers.Layer.TMS=OpenLayers.Class(OpenLayers.Layer.Grid,{serviceVersion:"1.0.0",layername:null,type:null,isBaseLayer:!0,tileOrigin:null,serverResolutions:null,zoomOffset:0,initialize:function(a,b,c){var d=[];d.push(a,b,{},c);OpenLayers.Layer.Grid.prototype.initialize.apply(this,d)},clone:function(a){null==a&&(a=new OpenLayers.Layer.TMS(this.name,this.url,this.getOptions()));return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a])},getURL:function(a){var a=this.adjustBounds(a),b=this.getServerResolution(),c=Math.round((a.left-this.tileOrigin.lon)/(b*this.tileSize.w)),a=Math.round((a.bottom-this.tileOrigin.lat)/(b*this.tileSize.h)),c=this.serviceVersion+"/"+this.layername+"/"+this.getServerZoom()+"/"+c+"/"+a+"."+this.type,a=this.url;OpenLayers.Util.isArray(a)&&(a=this.selectUrl(c,a));return a+c},setMap:function(a){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);this.tileOrigin||(this.tileOrigin=new OpenLayers.LonLat(this.map.maxExtent.left,this.map.maxExtent.bottom))},CLASS_NAME:"OpenLayers.Layer.TMS"});OpenLayers.Strategy.Fixed=OpenLayers.Class(OpenLayers.Strategy,{preload:!1,activate:function(){if(OpenLayers.Strategy.prototype.activate.apply(this,arguments)){this.layer.events.on({refresh:this.load,scope:this});if(!0==this.layer.visibility||this.preload)this.load();else this.layer.events.on({visibilitychanged:this.load,scope:this});return!0}return!1},deactivate:function(){var a=OpenLayers.Strategy.prototype.deactivate.call(this);a&&this.layer.events.un({refresh:this.load,visibilitychanged:this.load,scope:this});return a},load:function(a){var b=this.layer;b.events.triggerEvent("loadstart");b.protocol.read(OpenLayers.Util.applyDefaults({callback:OpenLayers.Function.bind(this.merge,this,b.map.getProjectionObject()),filter:b.filter},a));b.events.un({visibilitychanged:this.load,scope:this})},merge:function(a,b){var c=this.layer;c.destroyFeatures();var d=b.features;if(d&&0<d.length){if(!a.equals(c.projection))for(var e,f=0,g=d.length;f<g;++f)(e=d[f].geometry)&&e.transform(c.projection,a);c.addFeatures(d)}c.events.triggerEvent("loadend")},CLASS_NAME:"OpenLayers.Strategy.Fixed"});OpenLayers.Control.Zoom=OpenLayers.Class(OpenLayers.Control,{zoomInText:"+",zoomInId:"olZoomInLink",zoomOutText:"-",zoomOutId:"olZoomOutLink",draw:function(){var a=OpenLayers.Control.prototype.draw.apply(this),b=this.getOrCreateLinks(a),c=b.zoomIn,b=b.zoomOut,d=this.map.events;b.parentNode!==a&&(d=this.events,d.attachToElement(b.parentNode));d.register("buttonclick",this,this.onZoomClick);this.zoomInLink=c;this.zoomOutLink=b;return a},getOrCreateLinks:function(a){var b=document.getElementById(this.zoomInId),c=document.getElementById(this.zoomOutId);b||(b=document.createElement("a"),b.href="#zoomIn",b.appendChild(document.createTextNode(this.zoomInText)),b.className="olControlZoomIn",a.appendChild(b));OpenLayers.Element.addClass(b,"olButton");c||(c=document.createElement("a"),c.href="#zoomOut",c.appendChild(document.createTextNode(this.zoomOutText)),c.className="olControlZoomOut",a.appendChild(c));OpenLayers.Element.addClass(c,"olButton");return{zoomIn:b,zoomOut:c}},onZoomClick:function(a){a=a.buttonElement;a===this.zoomInLink?this.map.zoomIn():a===this.zoomOutLink&&this.map.zoomOut()},destroy:function(){this.map&&this.map.events.unregister("buttonclick",this,this.onZoomClick);delete this.zoomInLink;delete this.zoomOutLink;OpenLayers.Control.prototype.destroy.apply(this)},CLASS_NAME:"OpenLayers.Control.Zoom"});OpenLayers.Layer.PointTrack=OpenLayers.Class(OpenLayers.Layer.Vector,{dataFrom:null,styleFrom:null,addNodes:function(a,b){if(2>a.length)throw Error("At least two point features have to be added to create a line from");for(var c=Array(a.length-1),d,e,f,g=0,h=a.length;g<h;g++){d=a[g];if(f=d.geometry){if("OpenLayers.Geometry.Point"!=f.CLASS_NAME)throw new TypeError("Only features with point geometries are supported.")}else f=d.lonlat,f=new OpenLayers.Geometry.Point(f.lon,f.lat);if(0<g){d=null!=this.dataFrom?a[g+this.dataFrom].data||a[g+this.dataFrom].attributes:null;var i=null!=this.styleFrom?a[g+this.styleFrom].style:null;e=new OpenLayers.Geometry.LineString([e,f]);c[g-1]=new OpenLayers.Feature.Vector(e,d,i)}e=f}this.addFeatures(c,b)},CLASS_NAME:"OpenLayers.Layer.PointTrack"});OpenLayers.Layer.PointTrack.SOURCE_NODE=-1;OpenLayers.Layer.PointTrack.TARGET_NODE=0;OpenLayers.Layer.PointTrack.dataFrom={SOURCE_NODE:-1,TARGET_NODE:0};OpenLayers.Protocol.WFS=function(a){var a=OpenLayers.Util.applyDefaults(a,OpenLayers.Protocol.WFS.DEFAULTS),b=OpenLayers.Protocol.WFS["v"+a.version.replace(/\./g,"_")];if(!b)throw"Unsupported WFS version: "+a.version;return new b(a)};OpenLayers.Protocol.WFS.fromWMSLayer=function(a,b){var c,d;c=a.params.LAYERS;c=(OpenLayers.Util.isArray(c)?c[0]:c).split(":");1<c.length&&(d=c[0]);c=c.pop();d={url:a.url,featureType:c,featurePrefix:d,srsName:a.projection&&a.projection.getCode()||a.map&&a.map.getProjectionObject().getCode(),version:"1.1.0"};return new OpenLayers.Protocol.WFS(OpenLayers.Util.applyDefaults(b,d))};OpenLayers.Protocol.WFS.DEFAULTS={version:"1.0.0"};OpenLayers.Layer.Markers=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:!1,markers:null,drawn:!1,initialize:function(a,b){OpenLayers.Layer.prototype.initialize.apply(this,arguments);this.markers=[]},destroy:function(){this.clearMarkers();this.markers=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},setOpacity:function(a){if(a!=this.opacity){this.opacity=a;for(var a=0,b=this.markers.length;a<b;a++)this.markers[a].setOpacity(this.opacity)}},moveTo:function(a,b,c){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(b||!this.drawn){for(var d=0,e=this.markers.length;d<e;d++)this.drawMarker(this.markers[d]);this.drawn=!0}},addMarker:function(a){this.markers.push(a);1>this.opacity&&a.setOpacity(this.opacity);this.map&&this.map.getExtent()&&(a.map=this.map,this.drawMarker(a))},removeMarker:function(a){this.markers&&this.markers.length&&(OpenLayers.Util.removeItem(this.markers,a),a.erase())},clearMarkers:function(){if(null!=this.markers)for(;0<this.markers.length;)this.removeMarker(this.markers[0])},drawMarker:function(a){var b=this.map.getLayerPxFromLonLat(a.lonlat);null==b?a.display(!1):a.isDrawn()?a.icon&&a.icon.moveTo(b):this.div.appendChild(a.draw(b));
},getDataExtent:function(){var a=null;if(this.markers&&0<this.markers.length)for(var a=new OpenLayers.Bounds,b=0,c=this.markers.length;b<c;b++)a.extend(this.markers[b].lonlat);return a},CLASS_NAME:"OpenLayers.Layer.Markers"});OpenLayers.Control.Pan=OpenLayers.Class(OpenLayers.Control,{slideFactor:50,slideRatio:null,direction:null,type:OpenLayers.Control.TYPE_BUTTON,initialize:function(a,b){this.direction=a;this.CLASS_NAME+=this.direction;OpenLayers.Control.prototype.initialize.apply(this,[b])},trigger:function(){var a=OpenLayers.Function.bind(function(a){return this.slideRatio?this.map.getSize()[a]*this.slideRatio:this.slideFactor},this);switch(this.direction){case OpenLayers.Control.Pan.NORTH:this.map.pan(0,-a("h"));break;case OpenLayers.Control.Pan.SOUTH:this.map.pan(0,a("h"));break;case OpenLayers.Control.Pan.WEST:this.map.pan(-a("w"),0);break;case OpenLayers.Control.Pan.EAST:this.map.pan(a("w"),0)}},CLASS_NAME:"OpenLayers.Control.Pan"});OpenLayers.Control.Pan.NORTH="North";OpenLayers.Control.Pan.SOUTH="South";OpenLayers.Control.Pan.EAST="East";OpenLayers.Control.Pan.WEST="West";OpenLayers.Format.CSWGetDomain=function(a){var a=OpenLayers.Util.applyDefaults(a,OpenLayers.Format.CSWGetDomain.DEFAULTS),b=OpenLayers.Format.CSWGetDomain["v"+a.version.replace(/\./g,"_")];if(!b)throw"Unsupported CSWGetDomain version: "+a.version;return new b(a)};OpenLayers.Format.CSWGetDomain.DEFAULTS={version:"2.0.2"};OpenLayers.Format.CSWGetDomain.v2_0_2=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",csw:"http://www.opengis.net/cat/csw/2.0.2"},defaultPrefix:"csw",version:"2.0.2",schemaLocation:"http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd",PropertyName:null,ParameterName:null,read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a&&9==a.nodeType&&(a=a.documentElement);var b={};this.readNode(a,b);return b},readers:{csw:{GetDomainResponse:function(a,b){this.readChildNodes(a,b)},DomainValues:function(a,b){OpenLayers.Util.isArray(b.DomainValues)||(b.DomainValues=[]);for(var c=a.attributes,d={},e=0,f=c.length;e<f;++e)d[c[e].name]=c[e].nodeValue;this.readChildNodes(a,d);b.DomainValues.push(d)},PropertyName:function(a,b){b.PropertyName=this.getChildValue(a)},ParameterName:function(a,b){b.ParameterName=this.getChildValue(a)},ListOfValues:function(a,b){OpenLayers.Util.isArray(b.ListOfValues)||(b.ListOfValues=[]);this.readChildNodes(a,b.ListOfValues)},Value:function(a,b){for(var c=a.attributes,d={},e=0,f=c.length;e<f;++e)d[c[e].name]=c[e].nodeValue;d.value=this.getChildValue(a);b.push({Value:d})},ConceptualScheme:function(a,b){b.ConceptualScheme={};this.readChildNodes(a,b.ConceptualScheme)},Name:function(a,b){b.Name=this.getChildValue(a)},Document:function(a,b){b.Document=this.getChildValue(a)},Authority:function(a,b){b.Authority=this.getChildValue(a)},RangeOfValues:function(a,b){b.RangeOfValues={};this.readChildNodes(a,b.RangeOfValues)},MinValue:function(a,b){for(var c=a.attributes,d={},e=0,f=c.length;e<f;++e)d[c[e].name]=c[e].nodeValue;d.value=this.getChildValue(a);b.MinValue=d},MaxValue:function(a,b){for(var c=a.attributes,d={},e=0,f=c.length;e<f;++e)d[c[e].name]=c[e].nodeValue;d.value=this.getChildValue(a);b.MaxValue=d}}},write:function(a){a=this.writeNode("csw:GetDomain",a);return OpenLayers.Format.XML.prototype.write.apply(this,[a])},writers:{csw:{GetDomain:function(a){var b=this.createElementNSPlus("csw:GetDomain",{attributes:{service:"CSW",version:this.version}});if(a.PropertyName||this.PropertyName)this.writeNode("csw:PropertyName",a.PropertyName||this.PropertyName,b);else if(a.ParameterName||this.ParameterName)this.writeNode("csw:ParameterName",a.ParameterName||this.ParameterName,b);this.readChildNodes(b,a);return b},PropertyName:function(a){return this.createElementNSPlus("csw:PropertyName",{value:a})},ParameterName:function(a){return this.createElementNSPlus("csw:ParameterName",{value:a})}}},CLASS_NAME:"OpenLayers.Format.CSWGetDomain.v2_0_2"});OpenLayers.Format.ArcXML.Features=OpenLayers.Class(OpenLayers.Format.XML,{read:function(a){return(new OpenLayers.Format.ArcXML).read(a).features.feature}});OpenLayers.Control.Snapping=OpenLayers.Class(OpenLayers.Control,{DEFAULTS:{tolerance:10,node:!0,edge:!0,vertex:!0},greedy:!0,precedence:["node","vertex","edge"],resolution:null,geoToleranceCache:null,layer:null,feature:null,point:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.options=a||{};this.options.layer&&this.setLayer(this.options.layer);a=OpenLayers.Util.extend({},this.options.defaults);this.defaults=OpenLayers.Util.applyDefaults(a,this.DEFAULTS);this.setTargets(this.options.targets);0===this.targets.length&&this.layer&&this.addTargetLayer(this.layer);this.geoToleranceCache={}},setLayer:function(a){this.active?(this.deactivate(),this.layer=a,this.activate()):this.layer=a},setTargets:function(a){this.targets=[];if(a&&a.length)for(var b,c=0,d=a.length;c<d;++c)b=a[c],b instanceof OpenLayers.Layer.Vector?this.addTargetLayer(b):this.addTarget(b)},addTargetLayer:function(a){this.addTarget({layer:a})},addTarget:function(a){a=OpenLayers.Util.applyDefaults(a,this.defaults);a.nodeTolerance=a.nodeTolerance||a.tolerance;a.vertexTolerance=a.vertexTolerance||a.tolerance;a.edgeTolerance=a.edgeTolerance||a.tolerance;this.targets.push(a)},removeTargetLayer:function(a){for(var b,c=this.targets.length-1;0<=c;--c)b=this.targets[c],b.layer===a&&this.removeTarget(b)},removeTarget:function(a){return OpenLayers.Util.removeItem(this.targets,a)},activate:function(){var a=OpenLayers.Control.prototype.activate.call(this);if(a&&this.layer&&this.layer.events)this.layer.events.on({sketchstarted:this.onSketchModified,sketchmodified:this.onSketchModified,vertexmodified:this.onVertexModified,scope:this});return a},deactivate:function(){var a=OpenLayers.Control.prototype.deactivate.call(this);a&&this.layer&&this.layer.events&&this.layer.events.un({sketchstarted:this.onSketchModified,sketchmodified:this.onSketchModified,vertexmodified:this.onVertexModified,scope:this});this.point=this.feature=null;return a},onSketchModified:function(a){this.feature=a.feature;this.considerSnapping(a.vertex,a.vertex)},onVertexModified:function(a){this.feature=a.feature;var b=this.layer.map.getLonLatFromViewPortPx(a.pixel);this.considerSnapping(a.vertex,new OpenLayers.Geometry.Point(b.lon,b.lat))},considerSnapping:function(a,b){for(var c={rank:Number.POSITIVE_INFINITY,dist:Number.POSITIVE_INFINITY,x:null,y:null},d=!1,e,f,g=0,h=this.targets.length;g<h;++g)if(f=this.targets[g],e=this.testTarget(f,b))if(this.greedy){c=e;c.target=f;d=!0;break}else if(e.rank<c.rank||e.rank===c.rank&&e.dist<c.dist)c=e,c.target=f,d=!0;d&&(!1!==this.events.triggerEvent("beforesnap",{point:a,x:c.x,y:c.y,distance:c.dist,layer:c.target.layer,snapType:this.precedence[c.rank]})?(a.x=c.x,a.y=c.y,this.point=a,this.events.triggerEvent("snap",{point:a,snapType:this.precedence[c.rank],layer:c.target.layer,distance:c.dist})):d=!1);this.point&&!d&&(a.x=b.x,a.y=b.y,this.point=null,this.events.triggerEvent("unsnap",{point:a}))},testTarget:function(a,b){var c=this.layer.map.getResolution();if("minResolution"in a&&c<a.minResolution||"maxResolution"in a&&c>=a.maxResolution)return null;for(var c={node:this.getGeoTolerance(a.nodeTolerance,c),vertex:this.getGeoTolerance(a.vertexTolerance,c),edge:this.getGeoTolerance(a.edgeTolerance,c)},d=Math.max(c.node,c.vertex,c.edge),e={rank:Number.POSITIVE_INFINITY,dist:Number.POSITIVE_INFINITY},f=!1,g=a.layer.features,h,i,j,k,l,m,n=this.precedence.length,o=new OpenLayers.LonLat(b.x,b.y),p=0,q=g.length;p<q;++p)if(h=g[p],h!==this.feature&&(!h._sketch&&h.state!==OpenLayers.State.DELETE&&(!a.filter||a.filter.evaluate(h)))&&h.atPoint(o,d,d))for(var r=0,s=Math.min(e.rank+1,n);r<s;++r)if(i=this.precedence[r],a[i])if("edge"===i){if(j=h.geometry.distanceTo(b,{details:!0}),l=j.distance,l<=c[i]&&l<e.dist){e={rank:r,dist:l,x:j.x0,y:j.y0};f=!0;break}}else{j=h.geometry.getVertices("node"===i);m=!1;for(var t=0,u=j.length;t<u;++t)if(k=j[t],l=k.distanceTo(b),l<=c[i]&&(r<e.rank||r===e.rank&&l<e.dist))e={rank:r,dist:l,x:k.x,y:k.y},m=f=!0;if(m)break}return f?e:null},getGeoTolerance:function(a,b){b!==this.resolution&&(this.resolution=b,this.geoToleranceCache={});var c=this.geoToleranceCache[a];void 0===c&&(c=a*b,this.geoToleranceCache[a]=c);return c},destroy:function(){this.active&&this.deactivate();delete this.layer;delete this.targets;OpenLayers.Control.prototype.destroy.call(this)},CLASS_NAME:"OpenLayers.Control.Snapping"});OpenLayers.Date={toISOString:function(){if("toISOString"in Date.prototype)return function(a){return a.toISOString()};var a=function(a,c){for(var d=a+"";d.length<c;)d="0"+d;return d};return function(b){return isNaN(b.getTime())?"Invalid Date":b.getUTCFullYear()+"-"+a(b.getUTCMonth()+1,2)+"-"+a(b.getUTCDate(),2)+"T"+a(b.getUTCHours(),2)+":"+a(b.getUTCMinutes(),2)+":"+a(b.getUTCSeconds(),2)+"."+a(b.getUTCMilliseconds(),3)+"Z"}}(),parse:function(a){var b;if((a=a.match(/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/))&&(a[1]||a[7])){b=parseInt(a[1],10)||0;var c=parseInt(a[2],10)-1||0,d=parseInt(a[3],10)||1;b=new Date(Date.UTC(b,c,d));if(c=a[7]){var d=parseInt(a[4],10),e=parseInt(a[5],10),f=parseFloat(a[6]),g=f|0,f=Math.round(1e3*(f-g));b.setUTCHours(d,e,g,f);"Z"!==c&&(c=parseInt(c,10),a=parseInt(a[8],10)||0,b=new Date(b.getTime()+-1e3*(60*60*c+60*a)))}}else b=new Date("invalid");return b}};(function(){function a(){this._object=f&&!i?new f:new window.ActiveXObject("Microsoft.XMLHTTP");this._listeners=[]}function b(){return new a}function c(a){b.onreadystatechange&&b.onreadystatechange.apply(a);a.dispatchEvent({type:"readystatechange",bubbles:!1,cancelable:!1,timeStamp:new Date+0})}function d(a){try{a.responseText=a._object.responseText}catch(b){}try{var c;var d=a._object,e=d.responseXML,f=d.responseText;h&&(f&&e&&!e.documentElement&&d.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/))&&(e=new window.ActiveXObject("Microsoft.XMLDOM"),e.async=!1,e.validateOnParse=!1,e.loadXML(f));c=e&&(h&&0!=e.parseError||!e.documentElement||e.documentElement&&"parsererror"==e.documentElement.tagName)?null:e;a.responseXML=c}catch(g){}try{a.status=a._object.status}catch(i){}try{a.statusText=a._object.statusText}catch(r){}}function e(a){a._object.onreadystatechange=new window.Function}var f=window.XMLHttpRequest,g=!!window.controllers,h=window.document.all&&!window.opera,i=h&&window.navigator.userAgent.match(/MSIE 7.0/);b.prototype=a.prototype;g&&f.wrapped&&(b.wrapped=f.wrapped);b.UNSENT=0;b.OPENED=1;b.HEADERS_RECEIVED=2;b.LOADING=3;b.DONE=4;b.prototype.readyState=b.UNSENT;b.prototype.responseText="";b.prototype.responseXML=null;b.prototype.status=0;b.prototype.statusText="";b.prototype.priority="NORMAL";b.prototype.onreadystatechange=null;b.onreadystatechange=null;b.onopen=null;b.onsend=null;b.onabort=null;b.prototype.open=function(a,f,i,m,n){delete this._headers;arguments.length<3&&(i=true);this._async=i;var o=this,p=this.readyState,q;if(h&&i){q=function(){if(p!=b.DONE){e(o);o.abort()}};window.attachEvent("onunload",q)}b.onopen&&b.onopen.apply(this,arguments);arguments.length>4?this._object.open(a,f,i,m,n):arguments.length>3?this._object.open(a,f,i,m):this._object.open(a,f,i);this.readyState=b.OPENED;c(this);this._object.onreadystatechange=function(){if(!g||i){o.readyState=o._object.readyState;d(o);if(o._aborted)o.readyState=b.UNSENT;else{if(o.readyState==b.DONE){delete o._data;e(o);h&&i&&window.detachEvent("onunload",q)}p!=o.readyState&&c(o);p=o.readyState}}}};b.prototype.send=function(a){b.onsend&&b.onsend.apply(this,arguments);arguments.length||(a=null);if(a&&a.nodeType){a=window.XMLSerializer?(new window.XMLSerializer).serializeToString(a):a.xml;this._headers["Content-Type"]||this._object.setRequestHeader("Content-Type","application/xml")}this._data=a;a:{this._object.send(this._data);if(g&&!this._async){this.readyState=b.OPENED;for(d(this);this.readyState<b.DONE;){this.readyState++;c(this);if(this._aborted)break a}}}};b.prototype.abort=function(){b.onabort&&b.onabort.apply(this,arguments);if(this.readyState>b.UNSENT)this._aborted=true;this._object.abort();e(this);this.readyState=b.UNSENT;delete this._data};b.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders()};b.prototype.getResponseHeader=function(a){return this._object.getResponseHeader(a)};b.prototype.setRequestHeader=function(a,b){if(!this._headers)this._headers={};this._headers[a]=b;return this._object.setRequestHeader(a,b)};b.prototype.addEventListener=function(a,b,c){for(var d=0,e;e=this._listeners[d];d++)if(e[0]==a&&e[1]==b&&e[2]==c)return;this._listeners.push([a,b,c])};b.prototype.removeEventListener=function(a,b,c){for(var d=0,e;e=this._listeners[d];d++)if(e[0]==a&&e[1]==b&&e[2]==c)break;e&&this._listeners.splice(d,1)};b.prototype.dispatchEvent=function(a){a={type:a.type,target:this,currentTarget:this,eventPhase:2,bubbles:a.bubbles,cancelable:a.cancelable,timeStamp:a.timeStamp,stopPropagation:function(){},preventDefault:function(){},initEvent:function(){}};a.type=="readystatechange"&&this.onreadystatechange&&(this.onreadystatechange.handleEvent||this.onreadystatechange).apply(this,[a]);for(var b=0,c;c=this._listeners[b];b++)c[0]==a.type&&!c[2]&&(c[1].handleEvent||c[1]).apply(this,[a])};b.prototype.toString=function(){return"[object XMLHttpRequest]"};b.toString=function(){return"[XMLHttpRequest]"};window.Function.prototype.apply||(window.Function.prototype.apply=function(a,b){b||(b=[]);a.__func=this;a.__func(b[0],b[1],b[2],b[3],b[4]);delete a.__func});OpenLayers.Request.XMLHttpRequest=b})();OpenLayers.Format.KML=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{kml:"http://www.opengis.net/kml/2.2",gx:"http://www.google.com/kml/ext/2.2"},kmlns:"http://earth.google.com/kml/2.0",placemarksDesc:"No description available",foldersName:"OpenLayers export",foldersDesc:"Exported on "+new Date,extractAttributes:!0,kvpAttributes:!1,extractStyles:!1,extractTracks:!1,trackAttributes:null,internalns:null,features:null,styles:null,styleBaseUrl:"",fetched:null,maxDepth:0,initialize:function(a){this.regExes={trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g,kmlColor:/(\w{2})(\w{2})(\w{2})(\w{2})/,kmlIconPalette:/root:\/\/icons\/palette-(\d+)(\.\w+)/,straightBracket:/\$\[(.*?)\]/g};this.externalProjection=new OpenLayers.Projection("EPSG:4326");OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(a){this.features=[];this.styles={};this.fetched={};return this.parseData(a,{depth:0,styleBaseUrl:this.styleBaseUrl})},parseData:function(a,b){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));for(var c=["Link","NetworkLink","Style","StyleMap","Placemark"],d=0,e=c.length;d<e;++d){var f=c[d],g=this.getElementsByTagNameNS(a,"*",f);if(0!=g.length)switch(f.toLowerCase()){case"link":case"networklink":this.parseLinks(g,b);break;case"style":this.extractStyles&&this.parseStyles(g,b);break;case"stylemap":this.extractStyles&&this.parseStyleMaps(g,b);break;case"placemark":this.parseFeatures(g,b)}}return this.features},parseLinks:function(a,b){if(b.depth>=this.maxDepth)return!1;var c=OpenLayers.Util.extend({},b);c.depth++;for(var d=0,e=a.length;d<e;d++){var f=this.parseProperty(a[d],"*","href");f&&!this.fetched[f]&&(this.fetched[f]=!0,(f=this.fetchLink(f))&&this.parseData(f,c))}},fetchLink:function(a){if(a=OpenLayers.Request.GET({url:a,async:!1}))return a.responseText},parseStyles:function(a,b){for(var c=0,d=a.length;c<d;c++){var e=this.parseStyle(a[c]);e&&(this.styles[(b.styleBaseUrl||"")+"#"+e.id]=e)}},parseKmlColor:function(a){var b=null;a&&(a=a.match(this.regExes.kmlColor))&&(b={color:"#"+a[4]+a[3]+a[2],opacity:parseInt(a[1],16)/255});return b},parseStyle:function(a){for(var b={},c=["LineStyle","PolyStyle","IconStyle","BalloonStyle","LabelStyle"],d,e,f=0,g=c.length;f<g;++f)if(d=c[f],e=this.getElementsByTagNameNS(a,"*",d)[0])switch(d.toLowerCase()){case"linestyle":d=this.parseProperty(e,"*","color");if(d=this.parseKmlColor(d))b.strokeColor=d.color,b.strokeOpacity=d.opacity;(d=this.parseProperty(e,"*","width"))&&(b.strokeWidth=d);break;case"polystyle":d=this.parseProperty(e,"*","color");if(d=this.parseKmlColor(d))b.fillOpacity=d.opacity,b.fillColor=d.color;"0"==this.parseProperty(e,"*","fill")&&(b.fillColor="none");"0"==this.parseProperty(e,"*","outline")&&(b.strokeWidth="0");break;case"iconstyle":var h=parseFloat(this.parseProperty(e,"*","scale")||1);d=32*h;var i=32*h,j=this.getElementsByTagNameNS(e,"*","Icon")[0];if(j){var k=this.parseProperty(j,"*","href");if(k){var l=this.parseProperty(j,"*","w"),m=this.parseProperty(j,"*","h");OpenLayers.String.startsWith(k,"http://maps.google.com/mapfiles/kml")&&(!l&&!m)&&(m=l=64,h/=2);l=l||m;m=m||l;l&&(d=parseInt(l)*h);m&&(i=parseInt(m)*h);if(m=k.match(this.regExes.kmlIconPalette))l=m[1],m=m[2],k=this.parseProperty(j,"*","x"),j=this.parseProperty(j,"*","y"),k="http://maps.google.com/mapfiles/kml/pal"+l+"/icon"+(8*(j?7-j/32:7)+(k?k/32:0))+m;b.graphicOpacity=1;b.externalGraphic=k}}if(e=this.getElementsByTagNameNS(e,"*","hotSpot")[0])k=parseFloat(e.getAttribute("x")),j=parseFloat(e.getAttribute("y")),l=e.getAttribute("xunits"),"pixels"==l?b.graphicXOffset=-k*h:"insetPixels"==l?b.graphicXOffset=-d+k*h:"fraction"==l&&(b.graphicXOffset=-d*k),e=e.getAttribute("yunits"),"pixels"==e?b.graphicYOffset=-i+j*h+1:"insetPixels"==e?b.graphicYOffset=-(j*h)+1:"fraction"==e&&(b.graphicYOffset=-i*(1-j)+1);b.graphicWidth=d;b.graphicHeight=i;break;case"balloonstyle":(e=OpenLayers.Util.getXmlNodeValue(e))&&(b.balloonStyle=e.replace(this.regExes.straightBracket,"${$1}"));break;case"labelstyle":if(d=this.parseProperty(e,"*","color"),d=this.parseKmlColor(d))b.fontColor=d.color,b.fontOpacity=d.opacity}!b.strokeColor&&b.fillColor&&(b.strokeColor=b.fillColor);if((a=a.getAttribute("id"))&&b)b.id=a;return b},parseStyleMaps:function(a,b){for(var c=0,d=a.length;c<d;c++)for(var e=a[c],f=this.getElementsByTagNameNS(e,"*","Pair"),e=e.getAttribute("id"),g=0,h=f.length;g<h;g++){var i=f[g],j=this.parseProperty(i,"*","key");(i=this.parseProperty(i,"*","styleUrl"))&&"normal"==j&&(this.styles[(b.styleBaseUrl||"")+"#"+e]=this.styles[(b.styleBaseUrl||"")+i])}},parseFeatures:function(a,b){for(var c=[],d=0,e=a.length;d<e;d++){var f=a[d],g=this.parseFeature.apply(this,[f]);if(g){this.extractStyles&&(g.attributes&&g.attributes.styleUrl)&&(g.style=this.getStyle(g.attributes.styleUrl,b));if(this.extractStyles){var h=this.getElementsByTagNameNS(f,"*","Style")[0];if(h&&(h=this.parseStyle(h)))g.style=OpenLayers.Util.extend(g.style,h)}if(this.extractTracks){if((f=this.getElementsByTagNameNS(f,this.namespaces.gx,"Track"))&&0<f.length)g={features:[],feature:g},this.readNode(f[0],g),0<g.features.length&&c.push.apply(c,g.features)}else c.push(g)}else throw"Bad Placemark: "+d}this.features=this.features.concat(c)},readers:{kml:{when:function(a,b){b.whens.push(OpenLayers.Date.parse(this.getChildValue(a)))},_trackPointAttribute:function(a,b){var c=a.nodeName.split(":").pop();b.attributes[c].push(this.getChildValue(a))}},gx:{Track:function(a,b){var c={whens:[],points:[],angles:[]};if(this.trackAttributes){var d;c.attributes={};for(var e=0,f=this.trackAttributes.length;e<f;++e)d=this.trackAttributes[e],c.attributes[d]=[],d in this.readers.kml||(this.readers.kml[d]=this.readers.kml._trackPointAttribute)}this.readChildNodes(a,c);if(c.whens.length!==c.points.length)throw Error("gx:Track with unequal number of when ("+c.whens.length+") and gx:coord ("+c.points.length+") elements.");var g=0<c.angles.length;if(g&&c.whens.length!==c.angles.length)throw Error("gx:Track with unequal number of when ("+c.whens.length+") and gx:angles ("+c.angles.length+") elements.");for(var h,i,e=0,f=c.whens.length;e<f;++e){h=b.feature.clone();h.fid=b.feature.fid||b.feature.id;i=c.points[e];h.geometry=i;"z"in i&&(h.attributes.altitude=i.z);this.internalProjection&&this.externalProjection&&h.geometry.transform(this.externalProjection,this.internalProjection);if(this.trackAttributes){i=0;for(var j=this.trackAttributes.length;i<j;++i)h.attributes[d]=c.attributes[this.trackAttributes[i]][e]}h.attributes.when=c.whens[e];h.attributes.trackId=b.feature.id;g&&(i=c.angles[e],h.attributes.heading=parseFloat(i[0]),h.attributes.tilt=parseFloat(i[1]),h.attributes.roll=parseFloat(i[2]));b.features.push(h)}},coord:function(a,b){var c=this.getChildValue(a).replace(this.regExes.trimSpace,"").split(/\s+/),d=new OpenLayers.Geometry.Point(c[0],c[1]);2<c.length&&(d.z=parseFloat(c[2]));b.points.push(d)},angles:function(a,b){var c=this.getChildValue(a).replace(this.regExes.trimSpace,"").split(/\s+/);b.angles.push(c)}}},parseFeature:function(a){for(var b=["MultiGeometry","Polygon","LineString","Point"],c,d,e,f=0,g=b.length;f<g;++f)if(c=b[f],this.internalns=a.namespaceURI?a.namespaceURI:this.kmlns,d=this.getElementsByTagNameNS(a,this.internalns,c),0<d.length){if(b=this.parseGeometry[c.toLowerCase()])e=b.apply(this,[d[0]]),this.internalProjection&&this.externalProjection&&e.transform(this.externalProjection,this.internalProjection);else throw new TypeError("Unsupported geometry type: "+c);break}var h;this.extractAttributes&&(h=this.parseAttributes(a));c=new OpenLayers.Feature.Vector(e,h);a=a.getAttribute("id")||a.getAttribute("name");null!=a&&(c.fid=a);return c},getStyle:function(a,b){var c=OpenLayers.Util.removeTail(a),d=OpenLayers.Util.extend({},b);d.depth++;d.styleBaseUrl=c;!this.styles[a]&&!OpenLayers.String.startsWith(a,"#")&&d.depth<=this.maxDepth&&!this.fetched[c]&&(c=this.fetchLink(c))&&this.parseData(c,d);return OpenLayers.Util.extend({},this.styles[a])},parseGeometry:{point:function(a){var b=this.getElementsByTagNameNS(a,this.internalns,"coordinates"),a=[];if(0<b.length)var c=b[0].firstChild.nodeValue,c=c.replace(this.regExes.removeSpace,""),a=c.split(",");b=null;if(1<a.length)2==a.length&&(a[2]=null),b=new OpenLayers.Geometry.Point(a[0],a[1],a[2]);else throw"Bad coordinate string: "+c;return b},linestring:function(a,b){var c=this.getElementsByTagNameNS(a,this.internalns,"coordinates"),d=null;if(0<c.length){for(var c=this.getChildValue(c[0]),c=c.replace(this.regExes.trimSpace,""),c=c.replace(this.regExes.trimComma,","),d=c.split(this.regExes.splitSpace),e=d.length,f=Array(e),g,h,i=0;i<e;++i)if(g=d[i].split(","),h=g.length,1<h)2==g.length&&(g[2]=null),f[i]=new OpenLayers.Geometry.Point(g[0],g[1],g[2]);else throw"Bad LineString point coordinates: "+d[i];if(e)d=b?new OpenLayers.Geometry.LinearRing(f):new OpenLayers.Geometry.LineString(f);else throw"Bad LineString coordinates: "+c}return d},polygon:function(a){var a=this.getElementsByTagNameNS(a,this.internalns,"LinearRing"),b=a.length,c=Array(b);if(0<b)for(var d=0,e=a.length;d<e;++d)if(b=this.parseGeometry.linestring.apply(this,[a[d],!0]))c[d]=b;else throw"Bad LinearRing geometry: "+d;return new OpenLayers.Geometry.Polygon(c)},multigeometry:function(a){for(var b,c=[],d=a.childNodes,e=0,f=d.length;e<f;++e)a=d[e],1==a.nodeType&&(b=this.parseGeometry[(a.prefix?a.nodeName.split(":")[1]:a.nodeName).toLowerCase()])&&c.push(b.apply(this,[a]));return new OpenLayers.Geometry.Collection(c)}},parseAttributes:function(a){var b={},c=a.getElementsByTagName("ExtendedData");c.length&&(b=this.parseExtendedData(c[0]));for(var d,e,f,a=a.childNodes,c=0,g=a.length;c<g;++c)if(d=a[c],1==d.nodeType&&(e=d.childNodes,1<=e.length&&3>=e.length)){switch(e.length){case 1:f=e[0];break;case 2:f=e[0];e=e[1];f=3==f.nodeType||4==f.nodeType?f:e;break;default:f=e[1]}if(3==f.nodeType||4==f.nodeType)if(d=d.prefix?d.nodeName.split(":")[1]:d.nodeName,f=OpenLayers.Util.getXmlNodeValue(f))f=f.replace(this.regExes.trimSpace,""),b[d]=f}return b},parseExtendedData:function(a){var b={},c,d,e,f,g=a.getElementsByTagName("Data");c=0;for(d=g.length;c<d;c++){e=g[c];f=e.getAttribute("name");var h={},i=e.getElementsByTagName("value");i.length&&(h.value=this.getChildValue(i[0]));this.kvpAttributes?b[f]=h.value:(e=e.getElementsByTagName("displayName"),e.length&&(h.displayName=this.getChildValue(e[0])),b[f]=h)}a=a.getElementsByTagName("SimpleData");c=0;for(d=a.length;c<d;c++)h={},e=a[c],f=e.getAttribute("name"),h.value=this.getChildValue(e),this.kvpAttributes?b[f]=h.value:(h.displayName=f,b[f]=h);return b},parseProperty:function(a,b,c){var d,a=this.getElementsByTagNameNS(a,b,c);try{d=OpenLayers.Util.getXmlNodeValue(a[0])}catch(e){d=null}return d},write:function(a){OpenLayers.Util.isArray(a)||(a=[a]);for(var b=this.createElementNS(this.kmlns,"kml"),c=this.createFolderXML(),d=0,e=a.length;d<e;++d)c.appendChild(this.createPlacemarkXML(a[d]));b.appendChild(c);return OpenLayers.Format.XML.prototype.write.apply(this,[b])},createFolderXML:function(){var a=this.createElementNS(this.kmlns,"Folder");if(this.foldersName){var b=this.createElementNS(this.kmlns,"name"),c=this.createTextNode(this.foldersName);b.appendChild(c);a.appendChild(b)}this.foldersDesc&&(b=this.createElementNS(this.kmlns,"description"),c=this.createTextNode(this.foldersDesc),b.appendChild(c),a.appendChild(b));return a},createPlacemarkXML:function(a){var b=this.createElementNS(this.kmlns,"name");b.appendChild(this.createTextNode(a.style&&a.style.label?a.style.label:a.attributes.name||a.id));var c=this.createElementNS(this.kmlns,"description");c.appendChild(this.createTextNode(a.attributes.description||this.placemarksDesc));var d=this.createElementNS(this.kmlns,"Placemark");null!=a.fid&&d.setAttribute("id",a.fid);d.appendChild(b);d.appendChild(c);b=this.buildGeometryNode(a.geometry);d.appendChild(b);a.attributes&&(a=this.buildExtendedData(a.attributes))&&d.appendChild(a);return d},buildGeometryNode:function(a){var b=a.CLASS_NAME,b=this.buildGeometry[b.substring(b.lastIndexOf(".")+1).toLowerCase()],c=null;b&&(c=b.apply(this,[a]));return c},buildGeometry:{point:function(a){var b=this.createElementNS(this.kmlns,"Point");b.appendChild(this.buildCoordinatesNode(a));return b},multipoint:function(a){return this.buildGeometry.collection.apply(this,[a])},linestring:function(a){var b=this.createElementNS(this.kmlns,"LineString");b.appendChild(this.buildCoordinatesNode(a));return b},multilinestring:function(a){return this.buildGeometry.collection.apply(this,[a])},linearring:function(a){var b=this.createElementNS(this.kmlns,"LinearRing");b.appendChild(this.buildCoordinatesNode(a));return b},polygon:function(a){for(var b=this.createElementNS(this.kmlns,"Polygon"),a=a.components,c,d,e=0,f=a.length;e<f;++e)c=0==e?"outerBoundaryIs":"innerBoundaryIs",c=this.createElementNS(this.kmlns,c),d=this.buildGeometry.linearring.apply(this,[a[e]]),c.appendChild(d),b.appendChild(c);return b},multipolygon:function(a){return this.buildGeometry.collection.apply(this,[a])},collection:function(a){for(var b=this.createElementNS(this.kmlns,"MultiGeometry"),c,d=0,e=a.components.length;d<e;++d)(c=this.buildGeometryNode.apply(this,[a.components[d]]))&&b.appendChild(c);return b}},buildCoordinatesNode:function(a){var b=this.createElementNS(this.kmlns,"coordinates"),c;if(c=a.components){for(var d=c.length,e=Array(d),f=0;f<d;++f)a=c[f],e[f]=this.buildCoordinates(a);c=e.join(" ")}else c=this.buildCoordinates(a);c=this.createTextNode(c);b.appendChild(c);return b},buildCoordinates:function(a){this.internalProjection&&this.externalProjection&&(a=a.clone(),a.transform(this.internalProjection,this.externalProjection));return a.x+","+a.y},buildExtendedData:function(a){var b=this.createElementNS(this.kmlns,"ExtendedData"),c;for(c in a)if(a[c]&&"name"!=c&&"description"!=c&&"styleUrl"!=c){var d=this.createElementNS(this.kmlns,"Data");d.setAttribute("name",c);var e=this.createElementNS(this.kmlns,"value");if("object"==typeof a[c]){if(a[c].value&&e.appendChild(this.createTextNode(a[c].value)),a[c].displayName){var f=this.createElementNS(this.kmlns,"displayName");f.appendChild(this.getXMLDoc().createCDATASection(a[c].displayName));d.appendChild(f)}}else e.appendChild(this.createTextNode(a[c]));d.appendChild(e);b.appendChild(d)}return this.isSimpleContent(b)?null:b},CLASS_NAME:"OpenLayers.Format.KML"});OpenLayers.Popup=OpenLayers.Class({events:null,id:"",lonlat:null,div:null,contentSize:null,size:null,contentHTML:null,backgroundColor:"",opacity:"",border:"",contentDiv:null,groupDiv:null,closeDiv:null,autoSize:!1,minSize:null,maxSize:null,displayClass:"olPopup",contentDisplayClass:"olPopupContent",padding:0,disableFirefoxOverflowHack:!1,fixPadding:function(){"number"==typeof this.padding&&(this.padding=new OpenLayers.Bounds(this.padding,this.padding,this.padding,this.padding))},panMapIfOutOfView:!1,keepInMap:!1,closeOnMove:!1,map:null,initialize:function(a,b,c,d,e,f){null==a&&(a=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_"));this.id=a;this.lonlat=b;this.contentSize=null!=c?c:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT);null!=d&&(this.contentHTML=d);this.backgroundColor=OpenLayers.Popup.COLOR;this.opacity=OpenLayers.Popup.OPACITY;this.border=OpenLayers.Popup.BORDER;this.div=OpenLayers.Util.createDiv(this.id,null,null,null,null,null,"hidden");this.div.className=this.displayClass;this.groupDiv=OpenLayers.Util.createDiv(this.id+"_GroupDiv",null,null,null,"relative",null,"hidden");a=this.div.id+"_contentDiv";this.contentDiv=OpenLayers.Util.createDiv(a,null,this.contentSize.clone(),null,"relative");this.contentDiv.className=this.contentDisplayClass;this.groupDiv.appendChild(this.contentDiv);this.div.appendChild(this.groupDiv);e&&this.addCloseBox(f);this.registerEvents()},destroy:function(){this.border=this.opacity=this.backgroundColor=this.contentHTML=this.size=this.lonlat=this.id=null;this.closeOnMove&&this.map&&this.map.events.unregister("movestart",this,this.hide);this.events.destroy();this.events=null;this.closeDiv&&(OpenLayers.Event.stopObservingElement(this.closeDiv),this.groupDiv.removeChild(this.closeDiv));this.closeDiv=null;this.div.removeChild(this.groupDiv);this.groupDiv=null;null!=this.map&&this.map.removePopup(this);this.panMapIfOutOfView=this.padding=this.maxSize=this.minSize=this.autoSize=this.div=this.map=null},draw:function(a){null==a&&null!=this.lonlat&&null!=this.map&&(a=this.map.getLayerPxFromLonLat(this.lonlat));this.closeOnMove&&this.map.events.register("movestart",this,this.hide);!this.disableFirefoxOverflowHack&&"firefox"==OpenLayers.BROWSER_NAME&&(this.map.events.register("movestart",this,function(){var a=document.defaultView.getComputedStyle(this.contentDiv,null).getPropertyValue("overflow");"hidden"!=a&&(this.contentDiv._oldOverflow=a,this.contentDiv.style.overflow="hidden")}),this.map.events.register("moveend",this,function(){var a=this.contentDiv._oldOverflow;a&&(this.contentDiv.style.overflow=a,this.contentDiv._oldOverflow=null)}));this.moveTo(a);!this.autoSize&&!this.size&&this.setSize(this.contentSize);this.setBackgroundColor();this.setOpacity();this.setBorder();this.setContentHTML();this.panMapIfOutOfView&&this.panIntoView();return this.div},updatePosition:function(){if(this.lonlat&&this.map){var a=this.map.getLayerPxFromLonLat(this.lonlat);a&&this.moveTo(a)}},moveTo:function(a){null!=a&&null!=this.div&&(this.div.style.left=a.x+"px",this.div.style.top=a.y+"px")},visible:function(){return OpenLayers.Element.visible(this.div)},toggle:function(){this.visible()?this.hide():this.show()},show:function(){this.div.style.display="";this.panMapIfOutOfView&&this.panIntoView()},hide:function(){this.div.style.display="none"},setSize:function(a){this.size=a.clone();var b=this.getContentDivPadding(),c=b.left+b.right,d=b.top+b.bottom;this.fixPadding();c+=this.padding.left+this.padding.right;d+=this.padding.top+this.padding.bottom;if(this.closeDiv)var e=parseInt(this.closeDiv.style.width),c=c+(e+b.right);this.size.w+=c;this.size.h+=d;"msie"==OpenLayers.BROWSER_NAME&&(this.contentSize.w+=b.left+b.right,this.contentSize.h+=b.bottom+b.top);null!=this.div&&(this.div.style.width=this.size.w+"px",this.div.style.height=this.size.h+"px");null!=this.contentDiv&&(this.contentDiv.style.width=a.w+"px",
this.contentDiv.style.height=a.h+"px")},updateSize:function(){var a="<div class='"+this.contentDisplayClass+"'>"+this.contentDiv.innerHTML+"</div>",b=this.map?this.map.div:document.body,c=OpenLayers.Util.getRenderedDimensions(a,null,{displayClass:this.displayClass,containerElement:b}),d=this.getSafeContentSize(c),e=null;d.equals(c)?e=c:(c={w:d.w<c.w?d.w:null,h:d.h<c.h?d.h:null},c.w&&c.h?e=d:(a=OpenLayers.Util.getRenderedDimensions(a,c,{displayClass:this.contentDisplayClass,containerElement:b}),"hidden"!=OpenLayers.Element.getStyle(this.contentDiv,"overflow")&&a.equals(d)&&(d=OpenLayers.Util.getScrollbarWidth(),c.w?a.h+=d:a.w+=d),e=this.getSafeContentSize(a)));this.setSize(e)},setBackgroundColor:function(a){void 0!=a&&(this.backgroundColor=a);null!=this.div&&(this.div.style.backgroundColor=this.backgroundColor)},setOpacity:function(a){void 0!=a&&(this.opacity=a);null!=this.div&&(this.div.style.opacity=this.opacity,this.div.style.filter="alpha(opacity="+100*this.opacity+")")},setBorder:function(a){void 0!=a&&(this.border=a);null!=this.div&&(this.div.style.border=this.border)},setContentHTML:function(a){null!=a&&(this.contentHTML=a);null!=this.contentDiv&&(null!=this.contentHTML&&this.contentHTML!=this.contentDiv.innerHTML)&&(this.contentDiv.innerHTML=this.contentHTML,this.autoSize&&(this.registerImageListeners(),this.updateSize()))},registerImageListeners:function(){for(var a=function(){null!==this.popup.id&&(this.popup.updateSize(),this.popup.visible()&&this.popup.panMapIfOutOfView&&this.popup.panIntoView(),OpenLayers.Event.stopObserving(this.img,"load",this.img._onImageLoad))},b=this.contentDiv.getElementsByTagName("img"),c=0,d=b.length;c<d;c++){var e=b[c];if(0==e.width||0==e.height)e._onImgLoad=OpenLayers.Function.bind(a,{popup:this,img:e}),OpenLayers.Event.observe(e,"load",e._onImgLoad)}},getSafeContentSize:function(a){var a=a.clone(),b=this.getContentDivPadding(),c=b.left+b.right,d=b.top+b.bottom;this.fixPadding();c+=this.padding.left+this.padding.right;d+=this.padding.top+this.padding.bottom;if(this.closeDiv)var e=parseInt(this.closeDiv.style.width),c=c+(e+b.right);this.minSize&&(a.w=Math.max(a.w,this.minSize.w-c),a.h=Math.max(a.h,this.minSize.h-d));this.maxSize&&(a.w=Math.min(a.w,this.maxSize.w-c),a.h=Math.min(a.h,this.maxSize.h-d));if(this.map&&this.map.size){e=b=0;if(this.keepInMap&&!this.panMapIfOutOfView)switch(e=this.map.getPixelFromLonLat(this.lonlat),this.relativePosition){case"tr":b=e.x;e=this.map.size.h-e.y;break;case"tl":b=this.map.size.w-e.x;e=this.map.size.h-e.y;break;case"bl":b=this.map.size.w-e.x;e=e.y;break;case"br":b=e.x;e=e.y;break;default:b=e.x,e=this.map.size.h-e.y}d=this.map.size.h-this.map.paddingForPopups.top-this.map.paddingForPopups.bottom-d-e;a.w=Math.min(a.w,this.map.size.w-this.map.paddingForPopups.left-this.map.paddingForPopups.right-c-b);a.h=Math.min(a.h,d)}return a},getContentDivPadding:function(){var a=this._contentDivPadding;if(!a&&(null==this.div.parentNode&&(this.div.style.display="none",document.body.appendChild(this.div)),this._contentDivPadding=a=new OpenLayers.Bounds(OpenLayers.Element.getStyle(this.contentDiv,"padding-left"),OpenLayers.Element.getStyle(this.contentDiv,"padding-bottom"),OpenLayers.Element.getStyle(this.contentDiv,"padding-right"),OpenLayers.Element.getStyle(this.contentDiv,"padding-top")),this.div.parentNode==document.body))document.body.removeChild(this.div),this.div.style.display="";return a},addCloseBox:function(a){this.closeDiv=OpenLayers.Util.createDiv(this.id+"_close",null,{w:17,h:17});this.closeDiv.className="olPopupCloseBox";var b=this.getContentDivPadding();this.closeDiv.style.right=b.right+"px";this.closeDiv.style.top=b.top+"px";this.groupDiv.appendChild(this.closeDiv);a=a||function(a){this.hide();OpenLayers.Event.stop(a)};OpenLayers.Event.observe(this.closeDiv,"touchend",OpenLayers.Function.bindAsEventListener(a,this));OpenLayers.Event.observe(this.closeDiv,"click",OpenLayers.Function.bindAsEventListener(a,this))},panIntoView:function(){var a=this.map.getSize(),b=this.map.getViewPortPxFromLayerPx(new OpenLayers.Pixel(parseInt(this.div.style.left),parseInt(this.div.style.top))),c=b.clone();b.x<this.map.paddingForPopups.left?c.x=this.map.paddingForPopups.left:b.x+this.size.w>a.w-this.map.paddingForPopups.right&&(c.x=a.w-this.map.paddingForPopups.right-this.size.w);b.y<this.map.paddingForPopups.top?c.y=this.map.paddingForPopups.top:b.y+this.size.h>a.h-this.map.paddingForPopups.bottom&&(c.y=a.h-this.map.paddingForPopups.bottom-this.size.h);this.map.pan(b.x-c.x,b.y-c.y)},registerEvents:function(){this.events=new OpenLayers.Events(this,this.div,null,!0);this.events.on({mousedown:this.onmousedown,mousemove:this.onmousemove,mouseup:this.onmouseup,click:this.onclick,mouseout:this.onmouseout,dblclick:this.ondblclick,touchstart:function(a){OpenLayers.Event.stop(a,!0)},scope:this})},onmousedown:function(a){this.mousedown=!0;OpenLayers.Event.stop(a,!0)},onmousemove:function(a){this.mousedown&&OpenLayers.Event.stop(a,!0)},onmouseup:function(a){this.mousedown&&(this.mousedown=!1,OpenLayers.Event.stop(a,!0))},onclick:function(a){OpenLayers.Event.stop(a,!0)},onmouseout:function(){this.mousedown=!1},ondblclick:function(a){OpenLayers.Event.stop(a,!0)},CLASS_NAME:"OpenLayers.Popup"});OpenLayers.Popup.WIDTH=200;OpenLayers.Popup.HEIGHT=200;OpenLayers.Popup.COLOR="white";OpenLayers.Popup.OPACITY=1;OpenLayers.Popup.BORDER="0px";OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,keepInMap:!0,anchor:null,initialize:function(a,b,c,d,e,f,g){OpenLayers.Popup.prototype.initialize.apply(this,[a,b,c,d,f,g]);this.anchor=null!=e?e:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)}},destroy:function(){this.relativePosition=this.anchor=null;OpenLayers.Popup.prototype.destroy.apply(this,arguments)},show:function(){this.updatePosition();OpenLayers.Popup.prototype.show.apply(this,arguments)},moveTo:function(a){var b=this.relativePosition;this.relativePosition=this.calculateRelativePosition(a);a=this.calculateNewPx(a);OpenLayers.Popup.prototype.moveTo.apply(this,Array(a));this.relativePosition!=b&&this.updateRelativePosition()},setSize:function(a){OpenLayers.Popup.prototype.setSize.apply(this,arguments);this.lonlat&&this.map&&this.moveTo(this.map.getLayerPxFromLonLat(this.lonlat))},calculateRelativePosition:function(a){a=this.map.getLonLatFromLayerPx(a);a=this.map.getExtent().determineQuadrant(a);return OpenLayers.Bounds.oppositeQuadrant(a)},updateRelativePosition:function(){},calculateNewPx:function(a){var a=a.offset(this.anchor.offset),b=this.size||this.contentSize,c="t"==this.relativePosition.charAt(0);a.y+=c?-b.h:this.anchor.size.h;c="l"==this.relativePosition.charAt(1);a.x+=c?-b.w:this.anchor.size.w;return a},CLASS_NAME:"OpenLayers.Popup.Anchored"});OpenLayers.Console.warn("OpenLayers.Rico is deprecated");OpenLayers.Rico=OpenLayers.Rico||{};OpenLayers.Rico.Color=OpenLayers.Class({initialize:function(a,b,c){this.rgb={r:a,g:b,b:c}},setRed:function(a){this.rgb.r=a},setGreen:function(a){this.rgb.g=a},setBlue:function(a){this.rgb.b=a},setHue:function(a){var b=this.asHSB();b.h=a;this.rgb=OpenLayers.Rico.Color.HSBtoRGB(b.h,b.s,b.b)},setSaturation:function(a){var b=this.asHSB();b.s=a;this.rgb=OpenLayers.Rico.Color.HSBtoRGB(b.h,b.s,b.b)},setBrightness:function(a){var b=this.asHSB();b.b=a;this.rgb=OpenLayers.Rico.Color.HSBtoRGB(b.h,b.s,b.b)},darken:function(a){var b=this.asHSB();this.rgb=OpenLayers.Rico.Color.HSBtoRGB(b.h,b.s,Math.max(b.b-a,0))},brighten:function(a){var b=this.asHSB();this.rgb=OpenLayers.Rico.Color.HSBtoRGB(b.h,b.s,Math.min(b.b+a,1))},blend:function(a){this.rgb.r=Math.floor((this.rgb.r+a.rgb.r)/2);this.rgb.g=Math.floor((this.rgb.g+a.rgb.g)/2);this.rgb.b=Math.floor((this.rgb.b+a.rgb.b)/2)},isBright:function(){this.asHSB();return.5<this.asHSB().b},isDark:function(){return!this.isBright()},asRGB:function(){return"rgb("+this.rgb.r+","+this.rgb.g+","+this.rgb.b+")"},asHex:function(){return"#"+this.rgb.r.toColorPart()+this.rgb.g.toColorPart()+this.rgb.b.toColorPart()},asHSB:function(){return OpenLayers.Rico.Color.RGBtoHSB(this.rgb.r,this.rgb.g,this.rgb.b)},toString:function(){return this.asHex()}});OpenLayers.Rico.Color.createFromHex=function(a){if(4==a.length)for(var b=a,a="#",c=1;4>c;c++)a+=b.charAt(c)+b.charAt(c);0==a.indexOf("#")&&(a=a.substring(1));b=a.substring(0,2);c=a.substring(2,4);a=a.substring(4,6);return new OpenLayers.Rico.Color(parseInt(b,16),parseInt(c,16),parseInt(a,16))};OpenLayers.Rico.Color.createColorFromBackground=function(a){var b=OpenLayers.Element.getStyle(OpenLayers.Util.getElement(a),"backgroundColor");return"transparent"==b&&a.parentNode?OpenLayers.Rico.Color.createColorFromBackground(a.parentNode):null==b?new OpenLayers.Rico.Color(255,255,255):0==b.indexOf("rgb(")?(a=b.substring(4,b.length-1).split(","),new OpenLayers.Rico.Color(parseInt(a[0]),parseInt(a[1]),parseInt(a[2]))):0==b.indexOf("#")?OpenLayers.Rico.Color.createFromHex(b):new OpenLayers.Rico.Color(255,255,255)};OpenLayers.Rico.Color.HSBtoRGB=function(a,b,c){var d=0,e=0,f=0;if(0==b)f=e=d=parseInt(255*c+.5);else{var a=6*(a-Math.floor(a)),g=a-Math.floor(a),h=c*(1-b),i=c*(1-b*g),b=c*(1-b*(1-g));switch(parseInt(a)){case 0:d=255*c+.5;e=255*b+.5;f=255*h+.5;break;case 1:d=255*i+.5;e=255*c+.5;f=255*h+.5;break;case 2:d=255*h+.5;e=255*c+.5;f=255*b+.5;break;case 3:d=255*h+.5;e=255*i+.5;f=255*c+.5;break;case 4:d=255*b+.5;e=255*h+.5;f=255*c+.5;break;case 5:d=255*c+.5,e=255*h+.5,f=255*i+.5}}return{r:parseInt(d),g:parseInt(e),b:parseInt(f)}};OpenLayers.Rico.Color.RGBtoHSB=function(a,b,c){var d,e=a>b?a:b;c>e&&(e=c);var f=a<b?a:b;c<f&&(f=c);d=0!=e?(e-f)/e:0;if(0==d)a=0;else{var g=(e-a)/(e-f),h=(e-b)/(e-f),c=(e-c)/(e-f),a=(a==e?c-h:b==e?2+g-c:4+h-g)/6;0>a&&(a+=1)}return{h:a,s:d,b:e/255}};OpenLayers.Console.warn("OpenLayers.Rico is deprecated");OpenLayers.Rico=OpenLayers.Rico||{};OpenLayers.Rico.Corner={round:function(a,b){a=OpenLayers.Util.getElement(a);this._setOptions(b);var c=this.options.color;"fromElement"==this.options.color&&(c=this._background(a));var d=this.options.bgColor;"fromParent"==this.options.bgColor&&(d=this._background(a.offsetParent));this._roundCornersImpl(a,c,d)},changeColor:function(a,b){a.style.backgroundColor=b;for(var c=a.parentNode.getElementsByTagName("span"),d=0;d<c.length;d++)c[d].style.backgroundColor=b},changeOpacity:function(a,b){var c="alpha(opacity="+100*b+")";a.style.opacity=b;a.style.filter=c;for(var d=a.parentNode.getElementsByTagName("span"),e=0;e<d.length;e++)d[e].style.opacity=b,d[e].style.filter=c},reRound:function(a,b){var c=a.parentNode.childNodes[2];a.parentNode.removeChild(a.parentNode.childNodes[0]);a.parentNode.removeChild(c);this.round(a.parentNode,b)},_roundCornersImpl:function(a,b,c){this.options.border&&this._renderBorder(a,c);this._isTopRounded()&&this._roundTopCorners(a,b,c);this._isBottomRounded()&&this._roundBottomCorners(a,b,c)},_renderBorder:function(a,b){var c="1px solid "+this._borderColor(b);a.innerHTML="<div "+("style='border-left: "+c+";"+("border-right: "+c)+"'")+">"+a.innerHTML+"</div>"},_roundTopCorners:function(a,b,c){for(var d=this._createCorner(c),e=0;e<this.options.numSlices;e++)d.appendChild(this._createCornerSlice(b,c,e,"top"));a.style.paddingTop=0;a.insertBefore(d,a.firstChild)},_roundBottomCorners:function(a,b,c){for(var d=this._createCorner(c),e=this.options.numSlices-1;0<=e;e--)d.appendChild(this._createCornerSlice(b,c,e,"bottom"));a.style.paddingBottom=0;a.appendChild(d)},_createCorner:function(a){var b=document.createElement("div");b.style.backgroundColor=this._isTransparent()?"transparent":a;return b},_createCornerSlice:function(a,b,c,d){var e=document.createElement("span"),f=e.style;f.backgroundColor=a;f.display="block";f.height="1px";f.overflow="hidden";f.fontSize="1px";a=this._borderColor(a,b);this.options.border&&0==c?(f.borderTopStyle="solid",f.borderTopWidth="1px",f.borderLeftWidth="0px",f.borderRightWidth="0px",f.borderBottomWidth="0px",f.height="0px",f.borderColor=a):a&&(f.borderColor=a,f.borderStyle="solid",f.borderWidth="0px 1px");!this.options.compact&&c==this.options.numSlices-1&&(f.height="2px");this._setMargin(e,c,d);this._setBorder(e,c,d);return e},_setOptions:function(a){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:!0,border:!1,compact:!1};OpenLayers.Util.extend(this.options,a||{});this.options.numSlices=this.options.compact?2:4;this._isTransparent()&&(this.options.blend=!1)},_whichSideTop:function(){return this._hasString(this.options.corners,"all","top")||0<=this.options.corners.indexOf("tl")&&0<=this.options.corners.indexOf("tr")?"":0<=this.options.corners.indexOf("tl")?"left":0<=this.options.corners.indexOf("tr")?"right":""},_whichSideBottom:function(){return this._hasString(this.options.corners,"all","bottom")||0<=this.options.corners.indexOf("bl")&&0<=this.options.corners.indexOf("br")?"":0<=this.options.corners.indexOf("bl")?"left":0<=this.options.corners.indexOf("br")?"right":""},_borderColor:function(a,b){return"transparent"==a?b:this.options.border?this.options.border:this.options.blend?this._blend(b,a):""},_setMargin:function(a,b,c){b=this._marginSize(b);c="top"==c?this._whichSideTop():this._whichSideBottom();"left"==c?(a.style.marginLeft=b+"px",a.style.marginRight="0px"):"right"==c?(a.style.marginRight=b+"px",a.style.marginLeft="0px"):(a.style.marginLeft=b+"px",a.style.marginRight=b+"px")},_setBorder:function(a,b,c){b=this._borderSize(b);c="top"==c?this._whichSideTop():this._whichSideBottom();"left"==c?(a.style.borderLeftWidth=b+"px",a.style.borderRightWidth="0px"):"right"==c?(a.style.borderRightWidth=b+"px",a.style.borderLeftWidth="0px"):(a.style.borderLeftWidth=b+"px",a.style.borderRightWidth=b+"px");!1!=this.options.border&&(a.style.borderLeftWidth=b+"px",a.style.borderRightWidth=b+"px")},_marginSize:function(a){if(this._isTransparent())return 0;var b=[5,3,2,1],c=[3,2,1,0],d=[2,1],e=[1,0];return this.options.compact&&this.options.blend?e[a]:this.options.compact?d[a]:this.options.blend?c[a]:b[a]},_borderSize:function(a){var b=[5,3,2,1],c=[2,1,1,1],d=[1,0],e=[0,2,0,0];return this.options.compact&&(this.options.blend||this._isTransparent())?1:this.options.compact?d[a]:this.options.blend?c[a]:this.options.border?e[a]:this._isTransparent()?b[a]:0},_hasString:function(a){for(var b=1;b<arguments.length;b++)if(0<=a.indexOf(arguments[b]))return!0;return!1},_blend:function(a,b){var c=OpenLayers.Rico.Color.createFromHex(a);c.blend(OpenLayers.Rico.Color.createFromHex(b));return c},_background:function(a){try{return OpenLayers.Rico.Color.createColorFromBackground(a).asHex()}catch(b){return"#ffffff"}},_isTransparent:function(){return"transparent"==this.options.color},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr")},_isBottomRounded:function(){return this._hasString(this.options.corners,"all","bottom","bl","br")},_hasSingleTextChild:function(a){return 1==a.childNodes.length&&3==a.childNodes[0].nodeType}};OpenLayers.Popup.AnchoredBubble=OpenLayers.Class(OpenLayers.Popup.Anchored,{rounded:!1,initialize:function(a,b,c,d,e,f,g){OpenLayers.Console.warn("AnchoredBubble is deprecated");this.padding=new OpenLayers.Bounds(0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE,0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments)},draw:function(a){OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments);this.setContentHTML();this.setBackgroundColor();this.setOpacity();return this.div},updateRelativePosition:function(){this.setRicoCorners()},setSize:function(a){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.setRicoCorners()},setBackgroundColor:function(a){void 0!=a&&(this.backgroundColor=a);null!=this.div&&null!=this.contentDiv&&(this.div.style.background="transparent",OpenLayers.Rico.Corner.changeColor(this.groupDiv,this.backgroundColor))},setOpacity:function(a){OpenLayers.Popup.Anchored.prototype.setOpacity.call(this,a);null!=this.div&&null!=this.groupDiv&&OpenLayers.Rico.Corner.changeOpacity(this.groupDiv,this.opacity)},setBorder:function(){this.border=0},setRicoCorners:function(){var a={corners:this.getCornersToRound(this.relativePosition),color:this.backgroundColor,bgColor:"transparent",blend:!1};this.rounded?(OpenLayers.Rico.Corner.reRound(this.groupDiv,a),this.setBackgroundColor(),this.setOpacity()):(OpenLayers.Rico.Corner.round(this.div,a),this.rounded=!0)},getCornersToRound:function(){var a=["tl","tr","bl","br"],b=OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);OpenLayers.Util.removeItem(a,b);return a.join(" ")},CLASS_NAME:"OpenLayers.Popup.AnchoredBubble"});OpenLayers.Popup.AnchoredBubble.CORNER_SIZE=5;OpenLayers.Protocol.WFS.v1=OpenLayers.Class(OpenLayers.Protocol,{version:null,srsName:"EPSG:4326",featureType:null,featureNS:null,geometryName:"the_geom",schema:null,featurePrefix:"feature",formatOptions:null,readFormat:null,readOptions:null,initialize:function(a){OpenLayers.Protocol.prototype.initialize.apply(this,[a]);a.format||(this.format=OpenLayers.Format.WFST(OpenLayers.Util.extend({version:this.version,featureType:this.featureType,featureNS:this.featureNS,featurePrefix:this.featurePrefix,geometryName:this.geometryName,srsName:this.srsName,schema:this.schema},this.formatOptions)));!a.geometryName&&1<parseFloat(this.format.version)&&this.setGeometryName(null)},destroy:function(){this.options&&!this.options.format&&this.format.destroy();this.format=null;OpenLayers.Protocol.prototype.destroy.apply(this)},read:function(a){OpenLayers.Protocol.prototype.read.apply(this,arguments);a=OpenLayers.Util.extend({},a);OpenLayers.Util.applyDefaults(a,this.options||{});var b=new OpenLayers.Protocol.Response({requestType:"read"}),c=OpenLayers.Format.XML.prototype.write.apply(this.format,[this.format.writeNode("wfs:GetFeature",a)]);b.priv=OpenLayers.Request.POST({url:a.url,callback:this.createCallback(this.handleRead,b,a),params:a.params,headers:a.headers,data:c});return b},setFeatureType:function(a){this.featureType=a;this.format.featureType=a},setGeometryName:function(a){this.geometryName=a;this.format.geometryName=a},handleRead:function(a,b){b=OpenLayers.Util.extend({},b);OpenLayers.Util.applyDefaults(b,this.options);if(b.callback){var c=a.priv;200<=c.status&&300>c.status?(c=this.parseResponse(c,b.readOptions))&&!1!==c.success?(b.readOptions&&"object"==b.readOptions.output?OpenLayers.Util.extend(a,c):a.features=c,a.code=OpenLayers.Protocol.Response.SUCCESS):(a.code=OpenLayers.Protocol.Response.FAILURE,a.error=c):a.code=OpenLayers.Protocol.Response.FAILURE;b.callback.call(b.scope,a)}},parseResponse:function(a,b){var c=a.responseXML;if(!c||!c.documentElement)c=a.responseText;if(!c||0>=c.length)return null;c=null!==this.readFormat?this.readFormat.read(c):this.format.read(c,b);if(!this.featureNS){var d=this.readFormat||this.format;this.featureNS=d.featureNS;d.autoConfig=!1;this.geometryName||this.setGeometryName(d.geometryName)}return c},commit:function(a,b){b=OpenLayers.Util.extend({},b);OpenLayers.Util.applyDefaults(b,this.options);var c=new OpenLayers.Protocol.Response({requestType:"commit",reqFeatures:a});c.priv=OpenLayers.Request.POST({url:b.url,headers:b.headers,data:this.format.write(a,b),callback:this.createCallback(this.handleCommit,c,b)});return c},handleCommit:function(a,b){if(b.callback){var c=a.priv,d=c.responseXML;if(!d||!d.documentElement)d=c.responseText;c=this.format.read(d)||{};a.insertIds=c.insertIds||[];c.success?a.code=OpenLayers.Protocol.Response.SUCCESS:(a.code=OpenLayers.Protocol.Response.FAILURE,a.error=c);b.callback.call(b.scope,a)}},filterDelete:function(a,b){b=OpenLayers.Util.extend({},b);OpenLayers.Util.applyDefaults(b,this.options);new OpenLayers.Protocol.Response({requestType:"commit"});var c=this.format.createElementNSPlus("wfs:Transaction",{attributes:{service:"WFS",version:this.version}}),d=this.format.createElementNSPlus("wfs:Delete",{attributes:{typeName:(b.featureNS?this.featurePrefix+":":"")+b.featureType}});b.featureNS&&d.setAttribute("xmlns:"+this.featurePrefix,b.featureNS);var e=this.format.writeNode("ogc:Filter",a);d.appendChild(e);c.appendChild(d);c=OpenLayers.Format.XML.prototype.write.apply(this.format,[c]);return OpenLayers.Request.POST({url:this.url,callback:b.callback||function(){},data:c})},abort:function(a){a&&a.priv.abort()},CLASS_NAME:"OpenLayers.Protocol.WFS.v1"});OpenLayers.Handler.Point=OpenLayers.Class(OpenLayers.Handler,{point:null,layer:null,multi:!1,citeCompliant:!1,mouseDown:!1,stoppedDown:null,lastDown:null,lastUp:null,persist:!1,stopDown:!1,stopUp:!1,layerOptions:null,pixelTolerance:5,touch:!1,lastTouchPx:null,initialize:function(a,b,c){if(!c||!c.layerOptions||!c.layerOptions.styleMap)this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style["default"],{});OpenLayers.Handler.prototype.initialize.apply(this,arguments)},activate:function(){if(!OpenLayers.Handler.prototype.activate.apply(this,arguments))return!1;var a=OpenLayers.Util.extend({displayInLayerSwitcher:!1,calculateInRange:OpenLayers.Function.True,wrapDateLine:this.citeCompliant},this.layerOptions);this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,a);this.map.addLayer(this.layer);return!0},createFeature:function(a){a=this.layer.getLonLatFromViewPortPx(a);a=new OpenLayers.Geometry.Point(a.lon,a.lat);this.point=new OpenLayers.Feature.Vector(a);this.callback("create",[this.point.geometry,this.point]);this.point.geometry.clearBounds();this.layer.addFeatures([this.point],{silent:!0})},deactivate:function(){if(!OpenLayers.Handler.prototype.deactivate.apply(this,arguments))return!1;this.cancel();null!=this.layer.map&&(this.destroyFeature(!0),this.layer.destroy(!1));this.layer=null;this.touch=!1;return!0},destroyFeature:function(a){this.layer&&(a||!this.persist)&&this.layer.destroyFeatures();this.point=null},destroyPersistedFeature:function(){var a=this.layer;a&&1<a.features.length&&this.layer.features[0].destroy()},finalize:function(a){this.mouseDown=!1;this.lastTouchPx=this.lastUp=this.lastDown=null;this.callback(a?"cancel":"done",[this.geometryClone()]);this.destroyFeature(a)},cancel:function(){this.finalize(!0)},click:function(a){OpenLayers.Event.stop(a);return!1},dblclick:function(a){OpenLayers.Event.stop(a);return!1},modifyFeature:function(a){this.point||this.createFeature(a);a=this.layer.getLonLatFromViewPortPx(a);this.point.geometry.x=a.lon;this.point.geometry.y=a.lat;this.callback("modify",[this.point.geometry,this.point,!1]);this.point.geometry.clearBounds();this.drawFeature()},drawFeature:function(){this.layer.drawFeature(this.point,this.style)},getGeometry:function(){var a=this.point&&this.point.geometry;a&&this.multi&&(a=new OpenLayers.Geometry.MultiPoint([a]));return a},geometryClone:function(){var a=this.getGeometry();return a&&a.clone()},mousedown:function(a){return this.down(a)},touchstart:function(a){this.touch||(this.touch=!0,this.map.events.un({mousedown:this.mousedown,mouseup:this.mouseup,mousemove:this.mousemove,click:this.click,dblclick:this.dblclick,scope:this}));this.lastTouchPx=a.xy;return this.down(a)},mousemove:function(a){return this.move(a)},touchmove:function(a){this.lastTouchPx=a.xy;return this.move(a)},mouseup:function(a){return this.up(a)},touchend:function(a){a.xy=this.lastTouchPx;return this.up(a)},down:function(a){this.mouseDown=!0;this.lastDown=a.xy;this.touch||this.modifyFeature(a.xy);this.stoppedDown=this.stopDown;return!this.stopDown},move:function(a){!this.touch&&(!this.mouseDown||this.stoppedDown)&&this.modifyFeature(a.xy);return!0},up:function(a){this.mouseDown=!1;this.stoppedDown=this.stopDown;return this.checkModifiers(a)&&(!this.lastUp||!this.lastUp.equals(a.xy))&&this.lastDown&&this.passesTolerance(this.lastDown,a.xy,this.pixelTolerance)?(this.touch&&this.modifyFeature(a.xy),this.persist&&this.destroyPersistedFeature(),this.lastUp=a.xy,this.finalize(),!this.stopUp):!0},mouseout:function(a){OpenLayers.Util.mouseLeft(a,this.map.viewPortDiv)&&(this.stoppedDown=this.stopDown,this.mouseDown=!1)},passesTolerance:function(a,b,c){var d=!0;null!=c&&a&&b&&a.distanceTo(b)>c&&(d=!1);return d},CLASS_NAME:"OpenLayers.Handler.Point"});OpenLayers.Handler.Path=OpenLayers.Class(OpenLayers.Handler.Point,{line:null,maxVertices:null,doubleTouchTolerance:20,freehand:!1,freehandToggle:"shiftKey",timerId:null,redoStack:null,createFeature:function(a){a=this.layer.getLonLatFromViewPortPx(a);a=new OpenLayers.Geometry.Point(a.lon,a.lat);this.point=new OpenLayers.Feature.Vector(a);this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString([this.point.geometry]));this.callback("create",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.layer.addFeatures([this.line,this.point],{silent:!0})},destroyFeature:function(a){OpenLayers.Handler.Point.prototype.destroyFeature.call(this,a);this.line=null},destroyPersistedFeature:function(){var a=this.layer;a&&2<a.features.length&&this.layer.features[0].destroy()},removePoint:function(){this.point&&this.layer.removeFeatures([this.point])},addPoint:function(a){this.layer.removeFeatures([this.point]);a=this.layer.getLonLatFromViewPortPx(a);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(a.lon,a.lat));this.line.geometry.addComponent(this.point.geometry,this.line.geometry.components.length);this.layer.addFeatures([this.point]);this.callback("point",[this.point.geometry,this.getGeometry()]);this.callback("modify",[this.point.geometry,this.getSketch()]);this.drawFeature();delete this.redoStack},insertXY:function(a,b){this.line.geometry.addComponent(new OpenLayers.Geometry.Point(a,b),this.getCurrentPointIndex());this.drawFeature();delete this.redoStack},insertDeltaXY:function(a,b){var c=this.line.geometry.components[this.getCurrentPointIndex()-1];c&&(!isNaN(c.x)&&!isNaN(c.y))&&this.insertXY(c.x+a,c.y+b)},insertDirectionLength:function(a,b){var a=a*(Math.PI/180),c=b*Math.cos(a),d=b*Math.sin(a);this.insertDeltaXY(c,d)},insertDeflectionLength:function(a,b){var c=this.getCurrentPointIndex()-1;if(0<c){var d=this.line.geometry.components[c],c=this.line.geometry.components[c-1];this.insertDirectionLength(180*Math.atan2(d.y-c.y,d.x-c.x)/Math.PI+a,b)}},getCurrentPointIndex:function(){return this.line.geometry.components.length-1},undo:function(){var a=this.line.geometry,b=a.components,c=this.getCurrentPointIndex()-1,b=b[c];if(a=a.removeComponent(b))this.redoStack||(this.redoStack=[]),this.redoStack.push(b),this.drawFeature();return a},redo:function(){var a=this.redoStack&&this.redoStack.pop();a&&(this.line.geometry.addComponent(a,this.getCurrentPointIndex()),this.drawFeature());return!!a},freehandMode:function(a){return this.freehandToggle&&a[this.freehandToggle]?!this.freehand:this.freehand},modifyFeature:function(a,b){this.line||this.createFeature(a);var c=this.layer.getLonLatFromViewPortPx(a);this.point.geometry.x=c.lon;this.point.geometry.y=c.lat;this.callback("modify",[this.point.geometry,this.getSketch(),b]);this.point.geometry.clearBounds();this.drawFeature()},drawFeature:function(){this.layer.drawFeature(this.line,this.style);this.layer.drawFeature(this.point,this.style)},getSketch:function(){return this.line},getGeometry:function(){var a=this.line&&this.line.geometry;a&&this.multi&&(a=new OpenLayers.Geometry.MultiLineString([a]));return a},touchstart:function(a){if(this.timerId&&this.passesTolerance(this.lastTouchPx,a.xy,this.doubleTouchTolerance))return this.finishGeometry(),window.clearTimeout(this.timerId),this.timerId=null,!1;this.timerId&&(window.clearTimeout(this.timerId),this.timerId=null);this.timerId=window.setTimeout(OpenLayers.Function.bind(function(){this.timerId=null},this),300);return OpenLayers.Handler.Point.prototype.touchstart.call(this,a)},down:function(a){var b=this.stopDown;this.freehandMode(a)&&(b=!0,this.touch&&(this.modifyFeature(a.xy,!!this.lastUp),OpenLayers.Event.stop(a)));!this.touch&&(!this.lastDown||!this.passesTolerance(this.lastDown,a.xy,this.pixelTolerance))&&this.modifyFeature(a.xy,!!this.lastUp);this.mouseDown=!0;this.lastDown=a.xy;this.stoppedDown=b;return!b},move:function(a){if(this.stoppedDown&&this.freehandMode(a))return this.persist&&this.destroyPersistedFeature(),this.maxVertices&&this.line&&this.line.geometry.components.length===this.maxVertices?(this.removePoint(),this.finalize()):this.addPoint(a.xy),!1;!this.touch&&(!this.mouseDown||this.stoppedDown)&&this.modifyFeature(a.xy,!!this.lastUp);return!0},up:function(a){if(this.mouseDown&&(!this.lastUp||!this.lastUp.equals(a.xy)))this.stoppedDown&&this.freehandMode(a)?(this.persist&&this.destroyPersistedFeature(),this.removePoint(),this.finalize()):this.passesTolerance(this.lastDown,a.xy,this.pixelTolerance)&&(this.touch&&this.modifyFeature(a.xy),null==this.lastUp&&this.persist&&this.destroyPersistedFeature(),this.addPoint(a.xy),this.lastUp=a.xy,this.line.geometry.components.length===this.maxVertices+1&&this.finishGeometry());this.stoppedDown=this.stopDown;this.mouseDown=!1;return!this.stopUp},finishGeometry:function(){this.line.geometry.removeComponent(this.line.geometry.components[this.line.geometry.components.length-1]);this.removePoint();this.finalize()},dblclick:function(a){this.freehandMode(a)||this.finishGeometry();return!1},CLASS_NAME:"OpenLayers.Handler.Path"});OpenLayers.Spherical=OpenLayers.Spherical||{};OpenLayers.Spherical.DEFAULT_RADIUS=6378137;OpenLayers.Spherical.computeDistanceBetween=function(a,b,c){var c=c||OpenLayers.Spherical.DEFAULT_RADIUS,d=Math.sin(Math.PI*(b.lon-a.lon)/360),e=Math.sin(Math.PI*(b.lat-a.lat)/360),a=e*e+d*d*Math.cos(Math.PI*a.lat/180)*Math.cos(Math.PI*b.lat/180);return 2*c*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))};OpenLayers.Spherical.computeHeading=function(a,b){var c=Math.sin(Math.PI*(a.lon-b.lon)/180)*Math.cos(Math.PI*b.lat/180),d=Math.cos(Math.PI*a.lat/180)*Math.sin(Math.PI*b.lat/180)-Math.sin(Math.PI*a.lat/180)*Math.cos(Math.PI*b.lat/180)*Math.cos(Math.PI*(a.lon-b.lon)/180);return 180*Math.atan2(c,d)/Math.PI};OpenLayers.Control.CacheWrite=OpenLayers.Class(OpenLayers.Control,{layers:null,imageFormat:"image/png",quotaRegEx:/quota/i,setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);var b,c=this.layers||a.layers;for(b=c.length-1;0<=b;--b)this.addLayer({layer:c[b]});if(!this.layers)a.events.on({addlayer:this.addLayer,removeLayer:this.removeLayer,scope:this})},addLayer:function(a){a.layer.events.on({tileloadstart:this.makeSameOrigin,tileloaded:this.cache,scope:this})},removeLayer:function(a){a.layer.events.un({tileloadstart:this.makeSameOrigin,tileloaded:this.cache,scope:this})},makeSameOrigin:function(a){if(this.active&&(a=a.tile,a instanceof OpenLayers.Tile.Image&&!a.crossOriginKeyword&&"data:"!==a.url.substr(0,5))){var b=OpenLayers.Request.makeSameOrigin(a.url,OpenLayers.ProxyHost);OpenLayers.Control.CacheWrite.urlMap[b]=a.url;a.url=b}},cache:function(a){if(this.active&&window.localStorage&&(a=a.tile,a instanceof OpenLayers.Tile.Image&&"data:"!==a.url.substr(0,5)))try{var b=a.getCanvasContext();if(b){var c=OpenLayers.Control.CacheWrite.urlMap;window.localStorage.setItem("olCache_"+(c[a.url]||a.url),b.canvas.toDataURL(this.imageFormat));delete c[a.url]}}catch(d){(b=d.name||d.message)&&this.quotaRegEx.test(b)?this.events.triggerEvent("cachefull",{tile:a}):OpenLayers.Console.error(d.toString())}},destroy:function(){if(this.layers||this.map){var a,b=this.layers||this.map.layers;for(a=b.length-1;0<=a;--a)this.removeLayer({layer:b[a]})}this.map&&this.map.events.un({addlayer:this.addLayer,removeLayer:this.removeLayer,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments)},CLASS_NAME:"OpenLayers.Control.CacheWrite"});OpenLayers.Control.CacheWrite.clearCache=function(){if(window.localStorage){var a,b;for(a=window.localStorage.length-1;0<=a;--a)b=window.localStorage.key(a),"olCache_"===b.substr(0,8)&&window.localStorage.removeItem(b)}};OpenLayers.Control.CacheWrite.urlMap={};OpenLayers.Format.Context=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{layerOptions:null,layerParams:null,read:function(a,b){var c=OpenLayers.Format.XML.VersionedOGC.prototype.read.apply(this,arguments);if(b&&b.map)if(this.context=c,
b.map instanceof OpenLayers.Map)c=this.mergeContextToMap(c,b.map);else{var d=b.map;if(OpenLayers.Util.isElement(d)||"string"==typeof d)d={div:d};c=this.contextToMap(c,d)}return c},getLayerFromContext:function(a){var b,c,d={queryable:a.queryable,visibility:a.visibility,maxExtent:a.maxExtent,metadata:OpenLayers.Util.applyDefaults(a.metadata,{styles:a.styles,formats:a.formats,"abstract":a["abstract"],dataURL:a.dataURL}),numZoomLevels:a.numZoomLevels,units:a.units,isBaseLayer:a.isBaseLayer,opacity:a.opacity,displayInLayerSwitcher:a.displayInLayerSwitcher,singleTile:a.singleTile,tileSize:a.tileSize?new OpenLayers.Size(a.tileSize.width,a.tileSize.height):void 0,minScale:a.minScale||a.maxScaleDenominator,maxScale:a.maxScale||a.minScaleDenominator,srs:a.srs,dimensions:a.dimensions,metadataURL:a.metadataURL};this.layerOptions&&OpenLayers.Util.applyDefaults(d,this.layerOptions);var e={layers:a.name,transparent:a.transparent,version:a.version};if(a.formats&&0<a.formats.length){e.format=a.formats[0].value;b=0;for(c=a.formats.length;b<c;b++){var f=a.formats[b];if(!0==f.current){e.format=f.value;break}}}if(a.styles&&0<a.styles.length){b=0;for(c=a.styles.length;b<c;b++)if(f=a.styles[b],!0==f.current){f.href?e.sld=f.href:f.body?e.sld_body=f.body:e.styles=f.name;break}}this.layerParams&&OpenLayers.Util.applyDefaults(e,this.layerParams);b=null;c=a.service;c==OpenLayers.Format.Context.serviceTypes.WFS?(d.strategies=[new OpenLayers.Strategy.BBOX],d.protocol=new OpenLayers.Protocol.WFS({url:a.url,featurePrefix:a.name.split(":")[0],featureType:a.name.split(":").pop()}),b=new OpenLayers.Layer.Vector(a.title||a.name,d)):c==OpenLayers.Format.Context.serviceTypes.KML?(d.strategies=[new OpenLayers.Strategy.Fixed],d.protocol=new OpenLayers.Protocol.HTTP({url:a.url,format:new OpenLayers.Format.KML}),b=new OpenLayers.Layer.Vector(a.title||a.name,d)):c==OpenLayers.Format.Context.serviceTypes.GML?(d.strategies=[new OpenLayers.Strategy.Fixed],d.protocol=new OpenLayers.Protocol.HTTP({url:a.url,format:new OpenLayers.Format.GML}),b=new OpenLayers.Layer.Vector(a.title||a.name,d)):a.features?(b=new OpenLayers.Layer.Vector(a.title||a.name,d),b.addFeatures(a.features)):!0!==a.categoryLayer&&(b=new OpenLayers.Layer.WMS(a.title||a.name,a.url,e,d));return b},getLayersFromContext:function(a){for(var b=[],c=0,d=a.length;c<d;c++){var e=this.getLayerFromContext(a[c]);null!==e&&b.push(e)}return b},contextToMap:function(a,b){b=OpenLayers.Util.applyDefaults({maxExtent:a.maxExtent,projection:a.projection,units:a.units},b);b.maxExtent&&(b.maxResolution=b.maxExtent.getWidth()/OpenLayers.Map.TILE_WIDTH);b.metadata={contactInformation:a.contactInformation,"abstract":a["abstract"],keywords:a.keywords,logo:a.logo,descriptionURL:a.descriptionURL};var c=new OpenLayers.Map(b);c.addLayers(this.getLayersFromContext(a.layersContext));c.setCenter(a.bounds.getCenterLonLat(),c.getZoomForExtent(a.bounds,!0));return c},mergeContextToMap:function(a,b){b.addLayers(this.getLayersFromContext(a.layersContext));return b},write:function(a,b){a=this.toContext(a);return OpenLayers.Format.XML.VersionedOGC.prototype.write.apply(this,arguments)},CLASS_NAME:"OpenLayers.Format.Context"});OpenLayers.Format.Context.serviceTypes={WMS:"urn:ogc:serviceType:WMS",WFS:"urn:ogc:serviceType:WFS",WCS:"urn:ogc:serviceType:WCS",GML:"urn:ogc:serviceType:GML",SLD:"urn:ogc:serviceType:SLD",FES:"urn:ogc:serviceType:FES",KML:"urn:ogc:serviceType:KML"};OpenLayers.Format.WMC=OpenLayers.Class(OpenLayers.Format.Context,{defaultVersion:"1.1.0",layerToContext:function(a){var b=this.getParser(),c={queryable:a.queryable,visibility:a.visibility,name:a.params.LAYERS,title:a.name,"abstract":a.metadata["abstract"],dataURL:a.metadata.dataURL,metadataURL:a.metadataURL,server:{version:a.params.VERSION,url:a.url},maxExtent:a.maxExtent,transparent:a.params.TRANSPARENT,numZoomLevels:a.numZoomLevels,units:a.units,isBaseLayer:a.isBaseLayer,opacity:1==a.opacity?void 0:a.opacity,displayInLayerSwitcher:a.displayInLayerSwitcher,singleTile:a.singleTile,tileSize:a.singleTile||!a.tileSize?void 0:{width:a.tileSize.w,height:a.tileSize.h},minScale:a.options.resolutions||a.options.scales||a.options.maxResolution||a.options.minScale?a.minScale:void 0,maxScale:a.options.resolutions||a.options.scales||a.options.minResolution||a.options.maxScale?a.maxScale:void 0,formats:[],styles:[],srs:a.srs,dimensions:a.dimensions};a.metadata.servertitle&&(c.server.title=a.metadata.servertitle);if(a.metadata.formats&&0<a.metadata.formats.length)for(var d=0,e=a.metadata.formats.length;d<e;d++){var f=a.metadata.formats[d];c.formats.push({value:f.value,current:f.value==a.params.FORMAT})}else c.formats.push({value:a.params.FORMAT,current:!0});if(a.metadata.styles&&0<a.metadata.styles.length){d=0;for(e=a.metadata.styles.length;d<e;d++)b=a.metadata.styles[d],b.current=b.href==a.params.SLD||b.body==a.params.SLD_BODY||b.name==a.params.STYLES?!0:!1,c.styles.push(b)}else c.styles.push({href:a.params.SLD,body:a.params.SLD_BODY,name:a.params.STYLES||b.defaultStyleName,title:b.defaultStyleTitle,current:!0});return c},toContext:function(a){var b={},c=a.layers;if("OpenLayers.Map"==a.CLASS_NAME){var d=a.metadata||{};b.size=a.getSize();b.bounds=a.getExtent();b.projection=a.projection;b.title=a.title;b.keywords=d.keywords;b["abstract"]=d["abstract"];b.logo=d.logo;b.descriptionURL=d.descriptionURL;b.contactInformation=d.contactInformation;b.maxExtent=a.maxExtent}else OpenLayers.Util.applyDefaults(b,a),void 0!=b.layers&&delete b.layers;void 0==b.layersContext&&(b.layersContext=[]);if(void 0!=c&&OpenLayers.Util.isArray(c)){a=0;for(d=c.length;a<d;a++){var e=c[a];e instanceof OpenLayers.Layer.WMS&&b.layersContext.push(this.layerToContext(e))}}return b},CLASS_NAME:"OpenLayers.Format.WMC"});OpenLayers.Format.WMC.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ol:"http://openlayers.org/context",wmc:"http://www.opengis.net/context",sld:"http://www.opengis.net/sld",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},schemaLocation:"",getNamespacePrefix:function(a){var b=null;if(null==a)b=this.namespaces[this.defaultPrefix];else for(b in this.namespaces)if(this.namespaces[b]==a)break;return b},defaultPrefix:"wmc",rootPrefix:null,defaultStyleName:"",defaultStyleTitle:"Default",initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a=a.documentElement;this.rootPrefix=a.prefix;var b={version:a.getAttribute("version")};this.runChildNodes(b,a);return b},runChildNodes:function(a,b){for(var c=b.childNodes,d,e,f,g=0,h=c.length;g<h;++g)d=c[g],1==d.nodeType&&(e=this.getNamespacePrefix(d.namespaceURI),f=d.nodeName.split(":").pop(),(e=this["read_"+e+"_"+f])&&e.apply(this,[a,d]))},read_wmc_General:function(a,b){this.runChildNodes(a,b)},read_wmc_BoundingBox:function(a,b){a.projection=b.getAttribute("SRS");a.bounds=new OpenLayers.Bounds(b.getAttribute("minx"),b.getAttribute("miny"),b.getAttribute("maxx"),b.getAttribute("maxy"))},read_wmc_LayerList:function(a,b){a.layersContext=[];this.runChildNodes(a,b)},read_wmc_Layer:function(a,b){var c={visibility:"1"!=b.getAttribute("hidden"),queryable:"1"==b.getAttribute("queryable"),formats:[],styles:[],metadata:{}};this.runChildNodes(c,b);a.layersContext.push(c)},read_wmc_Extension:function(a,b){this.runChildNodes(a,b)},read_ol_units:function(a,b){a.units=this.getChildValue(b)},read_ol_maxExtent:function(a,b){var c=new OpenLayers.Bounds(b.getAttribute("minx"),b.getAttribute("miny"),b.getAttribute("maxx"),b.getAttribute("maxy"));a.maxExtent=c},read_ol_transparent:function(a,b){a.transparent=this.getChildValue(b)},read_ol_numZoomLevels:function(a,b){a.numZoomLevels=parseInt(this.getChildValue(b))},read_ol_opacity:function(a,b){a.opacity=parseFloat(this.getChildValue(b))},read_ol_singleTile:function(a,b){a.singleTile="true"==this.getChildValue(b)},read_ol_tileSize:function(a,b){var c={width:b.getAttribute("width"),height:b.getAttribute("height")};a.tileSize=c},read_ol_isBaseLayer:function(a,b){a.isBaseLayer="true"==this.getChildValue(b)},read_ol_displayInLayerSwitcher:function(a,b){a.displayInLayerSwitcher="true"==this.getChildValue(b)},read_wmc_Server:function(a,b){a.version=b.getAttribute("version");a.url=this.getOnlineResource_href(b);a.metadata.servertitle=b.getAttribute("title")},read_wmc_FormatList:function(a,b){this.runChildNodes(a,b)},read_wmc_Format:function(a,b){var c={value:this.getChildValue(b)};"1"==b.getAttribute("current")&&(c.current=!0);a.formats.push(c)},read_wmc_StyleList:function(a,b){this.runChildNodes(a,b)},read_wmc_Style:function(a,b){var c={};this.runChildNodes(c,b);"1"==b.getAttribute("current")&&(c.current=!0);a.styles.push(c)},read_wmc_SLD:function(a,b){this.runChildNodes(a,b)},read_sld_StyledLayerDescriptor:function(a,b){var c=OpenLayers.Format.XML.prototype.write.apply(this,[b]);a.body=c},read_sld_FeatureTypeStyle:function(a,b){var c=OpenLayers.Format.XML.prototype.write.apply(this,[b]);a.body=c},read_wmc_OnlineResource:function(a,b){a.href=this.getAttributeNS(b,this.namespaces.xlink,"href")},read_wmc_Name:function(a,b){var c=this.getChildValue(b);c&&(a.name=c)},read_wmc_Title:function(a,b){var c=this.getChildValue(b);c&&(a.title=c)},read_wmc_MetadataURL:function(a,b){a.metadataURL=this.getOnlineResource_href(b)},read_wmc_KeywordList:function(a,b){a.keywords=[];this.runChildNodes(a.keywords,b)},read_wmc_Keyword:function(a,b){a.push(this.getChildValue(b))},read_wmc_Abstract:function(a,b){var c=this.getChildValue(b);c&&(a["abstract"]=c)},read_wmc_LogoURL:function(a,b){a.logo={width:b.getAttribute("width"),height:b.getAttribute("height"),format:b.getAttribute("format"),href:this.getOnlineResource_href(b)}},read_wmc_DescriptionURL:function(a,b){a.descriptionURL=this.getOnlineResource_href(b)},read_wmc_ContactInformation:function(a,b){var c={};this.runChildNodes(c,b);a.contactInformation=c},read_wmc_ContactPersonPrimary:function(a,b){var c={};this.runChildNodes(c,b);a.personPrimary=c},read_wmc_ContactPerson:function(a,b){var c=this.getChildValue(b);c&&(a.person=c)},read_wmc_ContactOrganization:function(a,b){var c=this.getChildValue(b);c&&(a.organization=c)},read_wmc_ContactPosition:function(a,b){var c=this.getChildValue(b);c&&(a.position=c)},read_wmc_ContactAddress:function(a,b){var c={};this.runChildNodes(c,b);a.contactAddress=c},read_wmc_AddressType:function(a,b){var c=this.getChildValue(b);c&&(a.type=c)},read_wmc_Address:function(a,b){var c=this.getChildValue(b);c&&(a.address=c)},read_wmc_City:function(a,b){var c=this.getChildValue(b);c&&(a.city=c)},read_wmc_StateOrProvince:function(a,b){var c=this.getChildValue(b);c&&(a.stateOrProvince=c)},read_wmc_PostCode:function(a,b){var c=this.getChildValue(b);c&&(a.postcode=c)},read_wmc_Country:function(a,b){var c=this.getChildValue(b);c&&(a.country=c)},read_wmc_ContactVoiceTelephone:function(a,b){var c=this.getChildValue(b);c&&(a.phone=c)},read_wmc_ContactFacsimileTelephone:function(a,b){var c=this.getChildValue(b);c&&(a.fax=c)},read_wmc_ContactElectronicMailAddress:function(a,b){var c=this.getChildValue(b);c&&(a.email=c)},read_wmc_DataURL:function(a,b){a.dataURL=this.getOnlineResource_href(b)},read_wmc_LegendURL:function(a,b){var c={width:b.getAttribute("width"),height:b.getAttribute("height"),format:b.getAttribute("format"),href:this.getOnlineResource_href(b)};a.legend=c},read_wmc_DimensionList:function(a,b){a.dimensions={};this.runChildNodes(a.dimensions,b)},read_wmc_Dimension:function(a,b){var c={name:b.getAttribute("name").toLowerCase(),units:b.getAttribute("units")||"",unitSymbol:b.getAttribute("unitSymbol")||"",userValue:b.getAttribute("userValue")||"",nearestValue:"1"===b.getAttribute("nearestValue"),multipleValues:"1"===b.getAttribute("multipleValues"),current:"1"===b.getAttribute("current"),"default":b.getAttribute("default")||""},d=this.getChildValue(b);c.values=d.split(",");a[c.name]=c},write:function(a,b){var c=this.createElementDefaultNS("ViewContext");this.setAttributes(c,{version:this.VERSION,id:b&&"string"==typeof b.id?b.id:OpenLayers.Util.createUniqueID("OpenLayers_Context_")});this.setAttributeNS(c,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);c.appendChild(this.write_wmc_General(a));c.appendChild(this.write_wmc_LayerList(a));return OpenLayers.Format.XML.prototype.write.apply(this,[c])},createElementDefaultNS:function(a,b,c){a=this.createElementNS(this.namespaces[this.defaultPrefix],a);b&&a.appendChild(this.createTextNode(b));c&&this.setAttributes(a,c);return a},setAttributes:function(a,b){var c,d;for(d in b)c=b[d].toString(),c.match(/[A-Z]/)?this.setAttributeNS(a,null,d,c):a.setAttribute(d,c)},write_wmc_General:function(a){var b=this.createElementDefaultNS("General");a.size&&b.appendChild(this.createElementDefaultNS("Window",null,{width:a.size.w,height:a.size.h}));var c=a.bounds;b.appendChild(this.createElementDefaultNS("BoundingBox",null,{minx:c.left.toPrecision(18),miny:c.bottom.toPrecision(18),maxx:c.right.toPrecision(18),maxy:c.top.toPrecision(18),SRS:a.projection}));b.appendChild(this.createElementDefaultNS("Title",a.title));a.keywords&&b.appendChild(this.write_wmc_KeywordList(a.keywords));a["abstract"]&&b.appendChild(this.createElementDefaultNS("Abstract",a["abstract"]));a.logo&&b.appendChild(this.write_wmc_URLType("LogoURL",a.logo.href,a.logo));a.descriptionURL&&b.appendChild(this.write_wmc_URLType("DescriptionURL",a.descriptionURL));a.contactInformation&&b.appendChild(this.write_wmc_ContactInformation(a.contactInformation));b.appendChild(this.write_ol_MapExtension(a));return b},write_wmc_KeywordList:function(a){for(var b=this.createElementDefaultNS("KeywordList"),c=0,d=a.length;c<d;c++)b.appendChild(this.createElementDefaultNS("Keyword",a[c]));return b},write_wmc_ContactInformation:function(a){var b=this.createElementDefaultNS("ContactInformation");a.personPrimary&&b.appendChild(this.write_wmc_ContactPersonPrimary(a.personPrimary));a.position&&b.appendChild(this.createElementDefaultNS("ContactPosition",a.position));a.contactAddress&&b.appendChild(this.write_wmc_ContactAddress(a.contactAddress));a.phone&&b.appendChild(this.createElementDefaultNS("ContactVoiceTelephone",a.phone));a.fax&&b.appendChild(this.createElementDefaultNS("ContactFacsimileTelephone",a.fax));a.email&&b.appendChild(this.createElementDefaultNS("ContactElectronicMailAddress",a.email));return b},write_wmc_ContactPersonPrimary:function(a){var b=this.createElementDefaultNS("ContactPersonPrimary");a.person&&b.appendChild(this.createElementDefaultNS("ContactPerson",a.person));a.organization&&b.appendChild(this.createElementDefaultNS("ContactOrganization",a.organization));return b},write_wmc_ContactAddress:function(a){var b=this.createElementDefaultNS("ContactAddress");a.type&&b.appendChild(this.createElementDefaultNS("AddressType",a.type));a.address&&b.appendChild(this.createElementDefaultNS("Address",a.address));a.city&&b.appendChild(this.createElementDefaultNS("City",a.city));a.stateOrProvince&&b.appendChild(this.createElementDefaultNS("StateOrProvince",a.stateOrProvince));a.postcode&&b.appendChild(this.createElementDefaultNS("PostCode",a.postcode));a.country&&b.appendChild(this.createElementDefaultNS("Country",a.country));return b},write_ol_MapExtension:function(a){var b=this.createElementDefaultNS("Extension");if(a=a.maxExtent){var c=this.createElementNS(this.namespaces.ol,"ol:maxExtent");this.setAttributes(c,{minx:a.left.toPrecision(18),miny:a.bottom.toPrecision(18),maxx:a.right.toPrecision(18),maxy:a.top.toPrecision(18)});b.appendChild(c)}return b},write_wmc_LayerList:function(a){for(var b=this.createElementDefaultNS("LayerList"),c=0,d=a.layersContext.length;c<d;++c)b.appendChild(this.write_wmc_Layer(a.layersContext[c]));return b},write_wmc_Layer:function(a){var b=this.createElementDefaultNS("Layer",null,{queryable:a.queryable?"1":"0",hidden:a.visibility?"0":"1"});b.appendChild(this.write_wmc_Server(a));b.appendChild(this.createElementDefaultNS("Name",a.name));b.appendChild(this.createElementDefaultNS("Title",a.title));a["abstract"]&&b.appendChild(this.createElementDefaultNS("Abstract",a["abstract"]));a.dataURL&&b.appendChild(this.write_wmc_URLType("DataURL",a.dataURL));a.metadataURL&&b.appendChild(this.write_wmc_URLType("MetadataURL",a.metadataURL));return b},write_wmc_LayerExtension:function(a){var b=this.createElementDefaultNS("Extension"),c=a.maxExtent,d=this.createElementNS(this.namespaces.ol,"ol:maxExtent");this.setAttributes(d,{minx:c.left.toPrecision(18),miny:c.bottom.toPrecision(18),maxx:c.right.toPrecision(18),maxy:c.top.toPrecision(18)});b.appendChild(d);a.tileSize&&!a.singleTile&&(c=this.createElementNS(this.namespaces.ol,"ol:tileSize"),this.setAttributes(c,a.tileSize),b.appendChild(c));for(var c="transparent numZoomLevels units isBaseLayer opacity displayInLayerSwitcher singleTile".split(" "),e=0,f=c.length;e<f;++e)(d=this.createOLPropertyNode(a,c[e]))&&b.appendChild(d);return b},createOLPropertyNode:function(a,b){var c=null;null!=a[b]&&(c=this.createElementNS(this.namespaces.ol,"ol:"+b),c.appendChild(this.createTextNode(a[b].toString())));return c},write_wmc_Server:function(a){var a=a.server,b=this.createElementDefaultNS("Server"),c={service:"OGC:WMS",version:a.version};a.title&&(c.title=a.title);this.setAttributes(b,c);b.appendChild(this.write_wmc_OnlineResource(a.url));return b},write_wmc_URLType:function(a,b,c){a=this.createElementDefaultNS(a);a.appendChild(this.write_wmc_OnlineResource(b));if(c)for(var b=["width","height","format"],d=0;d<b.length;d++)b[d]in c&&a.setAttribute(b[d],c[b[d]]);return a},write_wmc_DimensionList:function(a){var b=this.createElementDefaultNS("DimensionList"),c;for(c in a.dimensions){var d={},e=a.dimensions[c],f;for(f in e)d[f]="boolean"==typeof e[f]?Number(e[f]):e[f];e="";d.values&&(e=d.values.join(","),delete d.values);b.appendChild(this.createElementDefaultNS("Dimension",e,d))}return b},write_wmc_FormatList:function(a){for(var b=this.createElementDefaultNS("FormatList"),c=0,d=a.formats.length;c<d;c++){var e=a.formats[c];b.appendChild(this.createElementDefaultNS("Format",e.value,e.current&&!0==e.current?{current:"1"}:null))}return b},write_wmc_StyleList:function(a){var b=this.createElementDefaultNS("StyleList");if((a=a.styles)&&OpenLayers.Util.isArray(a))for(var c,d=0,e=a.length;d<e;d++){var f=a[d],g=this.createElementDefaultNS("Style",null,f.current&&!0==f.current?{current:"1"}:null);f.href?(c=this.createElementDefaultNS("SLD"),f.name&&c.appendChild(this.createElementDefaultNS("Name",f.name)),f.title&&c.appendChild(this.createElementDefaultNS("Title",f.title)),f.legend&&c.appendChild(this.write_wmc_URLType("LegendURL",f.legend.href,f.legend)),f=this.write_wmc_OnlineResource(f.href),c.appendChild(f),g.appendChild(c)):f.body?(c=this.createElementDefaultNS("SLD"),f.name&&c.appendChild(this.createElementDefaultNS("Name",f.name)),f.title&&c.appendChild(this.createElementDefaultNS("Title",f.title)),f.legend&&c.appendChild(this.write_wmc_URLType("LegendURL",f.legend.href,f.legend)),f=OpenLayers.Format.XML.prototype.read.apply(this,[f.body]).documentElement,c.ownerDocument&&c.ownerDocument.importNode&&(f=c.ownerDocument.importNode(f,!0)),c.appendChild(f),g.appendChild(c)):(g.appendChild(this.createElementDefaultNS("Name",f.name)),g.appendChild(this.createElementDefaultNS("Title",f.title)),f["abstract"]&&g.appendChild(this.createElementDefaultNS("Abstract",f["abstract"])),f.legend&&g.appendChild(this.write_wmc_URLType("LegendURL",f.legend.href,f.legend)));b.appendChild(g)}return b},write_wmc_OnlineResource:function(a){var b=this.createElementDefaultNS("OnlineResource");this.setAttributeNS(b,this.namespaces.xlink,"xlink:type","simple");this.setAttributeNS(b,this.namespaces.xlink,"xlink:href",a);return b},getOnlineResource_href:function(a){var b={},a=a.getElementsByTagName("OnlineResource");0<a.length&&this.read_wmc_OnlineResource(b,a[0]);return b.href},CLASS_NAME:"OpenLayers.Format.WMC.v1"});OpenLayers.Control.PanPanel=OpenLayers.Class(OpenLayers.Control.Panel,{slideFactor:50,slideRatio:null,initialize:function(a){OpenLayers.Control.Panel.prototype.initialize.apply(this,[a]);a={slideFactor:this.slideFactor,slideRatio:this.slideRatio};this.addControls([new OpenLayers.Control.Pan(OpenLayers.Control.Pan.NORTH,a),new OpenLayers.Control.Pan(OpenLayers.Control.Pan.SOUTH,a),new OpenLayers.Control.Pan(OpenLayers.Control.Pan.EAST,a),new OpenLayers.Control.Pan(OpenLayers.Control.Pan.WEST,a)])},CLASS_NAME:"OpenLayers.Control.PanPanel"});OpenLayers.Control.Attribution=OpenLayers.Class(OpenLayers.Control,{separator:", ",template:"${layers}",destroy:function(){this.map.events.un({removelayer:this.updateAttribution,addlayer:this.updateAttribution,changelayer:this.updateAttribution,changebaselayer:this.updateAttribution,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.map.events.on({changebaselayer:this.updateAttribution,changelayer:this.updateAttribution,addlayer:this.updateAttribution,removelayer:this.updateAttribution,scope:this});this.updateAttribution();return this.div},updateAttribution:function(){var a=[];if(this.map&&this.map.layers){for(var b=0,c=this.map.layers.length;b<c;b++){var d=this.map.layers[b];d.attribution&&d.getVisibility()&&-1===OpenLayers.Util.indexOf(a,d.attribution)&&a.push(d.attribution)}this.div.innerHTML=OpenLayers.String.format(this.template,{layers:a.join(this.separator)})}},CLASS_NAME:"OpenLayers.Control.Attribution"});OpenLayers.Kinetic=OpenLayers.Class({threshold:0,deceleration:.0035,nbPoints:100,delay:200,points:void 0,timerId:void 0,initialize:function(a){OpenLayers.Util.extend(this,a)},begin:function(){OpenLayers.Animation.stop(this.timerId);this.timerId=void 0;this.points=[]},update:function(a){this.points.unshift({xy:a,tick:(new Date).getTime()});this.points.length>this.nbPoints&&this.points.pop()},end:function(a){for(var b,c=(new Date).getTime(),d=0,e=this.points.length,f;d<e;d++){f=this.points[d];if(c-f.tick>this.delay)break;b=f}if(b&&(d=(new Date).getTime()-b.tick,c=Math.sqrt(Math.pow(a.x-b.xy.x,2)+Math.pow(a.y-b.xy.y,2)),d=c/d,!(0==d||d<this.threshold)))return c=Math.asin((a.y-b.xy.y)/c),b.xy.x<=a.x&&(c=Math.PI-c),{speed:d,theta:c}},move:function(a,b){var c=a.speed,d=Math.cos(a.theta),e=-Math.sin(a.theta),f=(new Date).getTime(),g=0,h=0;this.timerId=OpenLayers.Animation.start(OpenLayers.Function.bind(function(){if(null!=this.timerId){var a=(new Date).getTime()-f,j=-this.deceleration*Math.pow(a,2)/2+c*a,k=j*d,j=j*e,l,m;l=!1;0>=-this.deceleration*a+c&&(OpenLayers.Animation.stop(this.timerId),this.timerId=null,l=!0);a=k-g;m=j-h;g=k;h=j;b(a,m,l)}},this))},CLASS_NAME:"OpenLayers.Kinetic"});OpenLayers.Layer.GeoRSS=OpenLayers.Class(OpenLayers.Layer.Markers,{location:null,features:null,formatOptions:null,selectedFeature:null,icon:null,popupSize:null,useFeedTitle:!0,initialize:function(a,b,c){OpenLayers.Layer.Markers.prototype.initialize.apply(this,[a,c]);this.location=b;this.features=[]},destroy:function(){OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments);this.clearFeatures();this.features=null},loadRSS:function(){this.loaded||(this.events.triggerEvent("loadstart"),OpenLayers.Request.GET({url:this.location,success:this.parseData,scope:this}),this.loaded=!0)},moveTo:function(a,b,c){OpenLayers.Layer.Markers.prototype.moveTo.apply(this,arguments);this.visibility&&!this.loaded&&this.loadRSS()},parseData:function(a){var b=a.responseXML;if(!b||!b.documentElement)b=OpenLayers.Format.XML.prototype.read(a.responseText);if(this.useFeedTitle){a=null;try{a=b.getElementsByTagNameNS("*","title")[0].firstChild.nodeValue}catch(c){a=b.getElementsByTagName("title")[0].firstChild.nodeValue}a&&this.setName(a)}a={};OpenLayers.Util.extend(a,this.formatOptions);this.map&&!this.projection.equals(this.map.getProjectionObject())&&(a.externalProjection=this.projection,a.internalProjection=this.map.getProjectionObject());for(var b=new OpenLayers.Format.GeoRSS(a).read(b),a=0,d=b.length;a<d;a++){var e={},f=b[a];if(f.geometry){var g=f.attributes.title?f.attributes.title:"Untitled",h=f.attributes.description?f.attributes.description:"No description.",i=f.attributes.link?f.attributes.link:"",f=f.geometry.getBounds().getCenterLonLat();e.icon=null==this.icon?OpenLayers.Marker.defaultIcon():this.icon.clone();e.popupSize=this.popupSize?this.popupSize.clone():new OpenLayers.Size(250,120);if(g||h){e.title=g;e.description=h;var j='<div class="olLayerGeoRSSClose">[x]</div>',j=j+'<div class="olLayerGeoRSSTitle">';i&&(j+='<a class="link" href="'+i+'" target="_blank">');j+=g;i&&(j+="</a>");j+="</div>";j+='<div style="" class="olLayerGeoRSSDescription">';j+=h;j+="</div>";e.popupContentHTML=j}f=new OpenLayers.Feature(this,f,e);this.features.push(f);e=f.createMarker();e.events.register("click",f,this.markerClick);this.addMarker(e)}}this.events.triggerEvent("loadend")},markerClick:function(a){var b=this==this.layer.selectedFeature;this.layer.selectedFeature=!b?this:null;for(var c=0,d=this.layer.map.popups.length;c<d;c++)this.layer.map.removePopup(this.layer.map.popups[c]);b||(b=this.createPopup(),OpenLayers.Event.observe(b.div,"click",OpenLayers.Function.bind(function(){for(var a=0,b=this.layer.map.popups.length;a<b;a++)this.layer.map.removePopup(this.layer.map.popups[a])},this)),this.layer.map.addPopup(b));OpenLayers.Event.stop(a)},clearFeatures:function(){if(null!=this.features)for(;0<this.features.length;){var a=this.features[0];OpenLayers.Util.removeItem(this.features,a);a.destroy()}},CLASS_NAME:"OpenLayers.Layer.GeoRSS"});OpenLayers.Symbolizer.Point=OpenLayers.Class(OpenLayers.Symbolizer,{initialize:function(a){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Symbolizer.Point"});OpenLayers.Symbolizer.Line=OpenLayers.Class(OpenLayers.Symbolizer,{initialize:function(a){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Symbolizer.Line"});OpenLayers.Symbolizer.Text=OpenLayers.Class(OpenLayers.Symbolizer,{initialize:function(a){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Symbolizer.Text"});OpenLayers.Format.SLD.v1=OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0,{namespaces:{sld:"http://www.opengis.net/sld",ogc:"http://www.opengis.net/ogc",gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},defaultPrefix:"sld",schemaLocation:null,multipleSymbolizers:!1,featureTypeCounter:null,defaultSymbolizer:{fillColor:"#808080",fillOpacity:1,strokeColor:"#000000",strokeOpacity:1,strokeWidth:1,strokeDashstyle:"solid",pointRadius:3,graphicName:"square"},read:function(a,b){var b=OpenLayers.Util.applyDefaults(b,this.options),c={namedLayers:!0===b.namedLayersAsArray?[]:{}};this.readChildNodes(a,c);return c},readers:OpenLayers.Util.applyDefaults({sld:{StyledLayerDescriptor:function(a,b){b.version=a.getAttribute("version");this.readChildNodes(a,b)},Name:function(a,b){b.name=this.getChildValue(a)},Title:function(a,b){b.title=this.getChildValue(a)},Abstract:function(a,b){b.description=this.getChildValue(a)},NamedLayer:function(a,b){var c={userStyles:[],namedStyles:[]};this.readChildNodes(a,c);for(var d=0,e=c.userStyles.length;d<e;++d)c.userStyles[d].layerName=c.name;OpenLayers.Util.isArray(b.namedLayers)?b.namedLayers.push(c):b.namedLayers[c.name]=c},NamedStyle:function(a,b){b.namedStyles.push(this.getChildName(a.firstChild))},UserStyle:function(a,b){var c={defaultsPerSymbolizer:!0,rules:[]};this.featureTypeCounter=-1;this.readChildNodes(a,c);this.multipleSymbolizers?(delete c.defaultsPerSymbolizer,c=new OpenLayers.Style2(c)):c=new OpenLayers.Style(this.defaultSymbolizer,c);b.userStyles.push(c)},IsDefault:function(a,b){"1"==this.getChildValue(a)&&(b.isDefault=!0)},FeatureTypeStyle:function(a,b){++this.featureTypeCounter;var c={rules:this.multipleSymbolizers?b.rules:[]};this.readChildNodes(a,c);this.multipleSymbolizers||(b.rules=c.rules)},Rule:function(a,b){var c;this.multipleSymbolizers&&(c={symbolizers:[]});c=new OpenLayers.Rule(c);this.readChildNodes(a,c);b.rules.push(c)},ElseFilter:function(a,b){b.elseFilter=!0},MinScaleDenominator:function(a,b){b.minScaleDenominator=parseFloat(this.getChildValue(a))},MaxScaleDenominator:function(a,b){b.maxScaleDenominator=parseFloat(this.getChildValue(a))},TextSymbolizer:function(a,b){var c={};this.readChildNodes(a,c);this.multipleSymbolizers?(c.zIndex=this.featureTypeCounter,b.symbolizers.push(new OpenLayers.Symbolizer.Text(c))):b.symbolizer.Text=OpenLayers.Util.applyDefaults(c,b.symbolizer.Text)},LabelPlacement:function(a,b){this.readChildNodes(a,b)},PointPlacement:function(a,b){var c={};this.readChildNodes(a,c);c.labelRotation=c.rotation;delete c.rotation;var d,e=b.labelAnchorPointX,f=b.labelAnchorPointY;e<=1/3?d="l":e>1/3&&e<2/3?d="c":e>=2/3&&(d="r");f<=1/3?d+="b":f>1/3&&f<2/3?d+="m":f>=2/3&&(d+="t");c.labelAlign=d;OpenLayers.Util.applyDefaults(b,c)},AnchorPoint:function(a,b){this.readChildNodes(a,b)},AnchorPointX:function(a,b){var c=this.readers.ogc._expression.call(this,a);c&&(b.labelAnchorPointX=c)},AnchorPointY:function(a,b){var c=this.readers.ogc._expression.call(this,a);c&&(b.labelAnchorPointY=c)},Displacement:function(a,b){this.readChildNodes(a,b)},DisplacementX:function(a,b){var c=this.readers.ogc._expression.call(this,a);c&&(b.labelXOffset=c)},DisplacementY:function(a,b){var c=this.readers.ogc._expression.call(this,a);c&&(b.labelYOffset=c)},LinePlacement:function(a,b){this.readChildNodes(a,b)},PerpendicularOffset:function(a,b){var c=this.readers.ogc._expression.call(this,a);c&&(b.labelPerpendicularOffset=c)},Label:function(a,b){var c=this.readers.ogc._expression.call(this,a);c&&(b.label=c)},Font:function(a,b){this.readChildNodes(a,b)},Halo:function(a,b){var c={};this.readChildNodes(a,c);b.haloRadius=c.haloRadius;b.haloColor=c.fillColor;b.haloOpacity=c.fillOpacity},Radius:function(a,b){var c=this.readers.ogc._expression.call(this,a);null!=c&&(b.haloRadius=c)},RasterSymbolizer:function(a,b){var c={};this.readChildNodes(a,c);this.multipleSymbolizers?(c.zIndex=this.featureTypeCounter,b.symbolizers.push(new OpenLayers.Symbolizer.Raster(c))):b.symbolizer.Raster=OpenLayers.Util.applyDefaults(c,b.symbolizer.Raster)},Geometry:function(a,b){b.geometry={};this.readChildNodes(a,b.geometry)},ColorMap:function(a,b){b.colorMap=[];this.readChildNodes(a,b.colorMap)},ColorMapEntry:function(a,b){var c=a.getAttribute("quantity"),d=a.getAttribute("opacity");b.push({color:a.getAttribute("color"),quantity:null!==c?parseFloat(c):void 0,label:a.getAttribute("label")||void 0,opacity:null!==d?parseFloat(d):void 0})},LineSymbolizer:function(a,b){var c={};this.readChildNodes(a,c);this.multipleSymbolizers?(c.zIndex=this.featureTypeCounter,b.symbolizers.push(new OpenLayers.Symbolizer.Line(c))):b.symbolizer.Line=OpenLayers.Util.applyDefaults(c,b.symbolizer.Line)},PolygonSymbolizer:function(a,b){var c={fill:!1,stroke:!1};this.multipleSymbolizers||(c=b.symbolizer.Polygon||c);this.readChildNodes(a,c);this.multipleSymbolizers?(c.zIndex=this.featureTypeCounter,b.symbolizers.push(new OpenLayers.Symbolizer.Polygon(c))):b.symbolizer.Polygon=c},PointSymbolizer:function(a,b){var c={fill:!1,stroke:!1,graphic:!1};this.multipleSymbolizers||(c=b.symbolizer.Point||c);this.readChildNodes(a,c);this.multipleSymbolizers?(c.zIndex=this.featureTypeCounter,b.symbolizers.push(new OpenLayers.Symbolizer.Point(c))):b.symbolizer.Point=c},Stroke:function(a,b){b.stroke=!0;this.readChildNodes(a,b)},Fill:function(a,b){b.fill=!0;this.readChildNodes(a,b)},CssParameter:function(a,b){var c=a.getAttribute("name"),d=this.cssMap[c];b.label&&("fill"===c?d="fontColor":"fill-opacity"===c&&(d="fontOpacity"));d&&(c=this.readers.ogc._expression.call(this,a))&&(b[d]=c)},Graphic:function(a,b){b.graphic=!0;var c={};this.readChildNodes(a,c);for(var d="stroke strokeColor strokeWidth strokeOpacity strokeLinecap fill fillColor fillOpacity graphicName rotation graphicFormat".split(" "),e,f,g=0,h=d.length;g<h;++g)e=d[g],f=c[e],void 0!=f&&(b[e]=f);
void 0!=c.opacity&&(b.graphicOpacity=c.opacity);void 0!=c.size&&(isNaN(c.size/2)?b.graphicWidth=c.size:b.pointRadius=c.size/2);void 0!=c.href&&(b.externalGraphic=c.href);void 0!=c.rotation&&(b.rotation=c.rotation)},ExternalGraphic:function(a,b){this.readChildNodes(a,b)},Mark:function(a,b){this.readChildNodes(a,b)},WellKnownName:function(a,b){b.graphicName=this.getChildValue(a)},Opacity:function(a,b){var c=this.readers.ogc._expression.call(this,a);c&&(b.opacity=c)},Size:function(a,b){var c=this.readers.ogc._expression.call(this,a);c&&(b.size=c)},Rotation:function(a,b){var c=this.readers.ogc._expression.call(this,a);c&&(b.rotation=c)},OnlineResource:function(a,b){b.href=this.getAttributeNS(a,this.namespaces.xlink,"href")},Format:function(a,b){b.graphicFormat=this.getChildValue(a)}}},OpenLayers.Format.Filter.v1_0_0.prototype.readers),cssMap:{stroke:"strokeColor","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-dasharray":"strokeDashstyle",fill:"fillColor","fill-opacity":"fillOpacity","font-family":"fontFamily","font-size":"fontSize","font-weight":"fontWeight","font-style":"fontStyle"},getCssProperty:function(a){var b=null,c;for(c in this.cssMap)if(this.cssMap[c]==a){b=c;break}return b},getGraphicFormat:function(a){var b,c;for(c in this.graphicFormats)if(this.graphicFormats[c].test(a)){b=c;break}return b||this.defaultGraphicFormat},defaultGraphicFormat:"image/png",graphicFormats:{"image/jpeg":/\.jpe?g$/i,"image/gif":/\.gif$/i,"image/png":/\.png$/i},write:function(a){return this.writers.sld.StyledLayerDescriptor.apply(this,[a])},writers:OpenLayers.Util.applyDefaults({sld:{_OGCExpression:function(a,b){var c=this.createElementNSPlus(a),d="string"==typeof b?b.split("${"):[b];c.appendChild(this.createTextNode(d[0]));for(var e,f,g=1,h=d.length;g<h;g++)e=d[g],f=e.indexOf("}"),0<f?(this.writeNode("ogc:PropertyName",{property:e.substring(0,f)},c),c.appendChild(this.createTextNode(e.substring(++f)))):c.appendChild(this.createTextNode("${"+e));return c},StyledLayerDescriptor:function(a){var b=this.createElementNSPlus("sld:StyledLayerDescriptor",{attributes:{version:this.VERSION,"xsi:schemaLocation":this.schemaLocation}});b.setAttribute("xmlns:ogc",this.namespaces.ogc);b.setAttribute("xmlns:gml",this.namespaces.gml);a.name&&this.writeNode("Name",a.name,b);a.title&&this.writeNode("Title",a.title,b);a.description&&this.writeNode("Abstract",a.description,b);if(OpenLayers.Util.isArray(a.namedLayers))for(var c=0,d=a.namedLayers.length;c<d;++c)this.writeNode("NamedLayer",a.namedLayers[c],b);else for(c in a.namedLayers)this.writeNode("NamedLayer",a.namedLayers[c],b);return b},Name:function(a){return this.createElementNSPlus("sld:Name",{value:a})},Title:function(a){return this.createElementNSPlus("sld:Title",{value:a})},Abstract:function(a){return this.createElementNSPlus("sld:Abstract",{value:a})},NamedLayer:function(a){var b=this.createElementNSPlus("sld:NamedLayer");this.writeNode("Name",a.name,b);if(a.namedStyles)for(var c=0,d=a.namedStyles.length;c<d;++c)this.writeNode("NamedStyle",a.namedStyles[c],b);if(a.userStyles){c=0;for(d=a.userStyles.length;c<d;++c)this.writeNode("UserStyle",a.userStyles[c],b)}return b},NamedStyle:function(a){var b=this.createElementNSPlus("sld:NamedStyle");this.writeNode("Name",a,b);return b},UserStyle:function(a){var b=this.createElementNSPlus("sld:UserStyle");a.name&&this.writeNode("Name",a.name,b);a.title&&this.writeNode("Title",a.title,b);a.description&&this.writeNode("Abstract",a.description,b);a.isDefault&&this.writeNode("IsDefault",a.isDefault,b);if(this.multipleSymbolizers&&a.rules){for(var c={0:[]},d=[0],e,f,g,h,i,j=0,k=a.rules.length;j<k;++j)if(e=a.rules[j],e.symbolizers){f={};for(var l=0,m=e.symbolizers.length;l<m;++l)g=e.symbolizers[l],h=g.zIndex,h in f||(i=e.clone(),i.symbolizers=[],f[h]=i),f[h].symbolizers.push(g.clone());for(h in f)h in c||(d.push(h),c[h]=[]),c[h].push(f[h])}else c[0].push(e.clone());d.sort();j=0;for(k=d.length;j<k;++j)e=c[d[j]],0<e.length&&(i=a.clone(),i.rules=c[d[j]],this.writeNode("FeatureTypeStyle",i,b))}else this.writeNode("FeatureTypeStyle",a,b);return b},IsDefault:function(a){return this.createElementNSPlus("sld:IsDefault",{value:a?"1":"0"})},FeatureTypeStyle:function(a){for(var b=this.createElementNSPlus("sld:FeatureTypeStyle"),c=0,d=a.rules.length;c<d;++c)this.writeNode("Rule",a.rules[c],b);return b},Rule:function(a){var b=this.createElementNSPlus("sld:Rule");a.name&&this.writeNode("Name",a.name,b);a.title&&this.writeNode("Title",a.title,b);a.description&&this.writeNode("Abstract",a.description,b);a.elseFilter?this.writeNode("ElseFilter",null,b):a.filter&&this.writeNode("ogc:Filter",a.filter,b);void 0!=a.minScaleDenominator&&this.writeNode("MinScaleDenominator",a.minScaleDenominator,b);void 0!=a.maxScaleDenominator&&this.writeNode("MaxScaleDenominator",a.maxScaleDenominator,b);var c,d;if(this.multipleSymbolizers&&a.symbolizers)for(var e=0,f=a.symbolizers.length;e<f;++e)d=a.symbolizers[e],c=d.CLASS_NAME.split(".").pop(),this.writeNode(c+"Symbolizer",d,b);else for(var f=OpenLayers.Style.SYMBOLIZER_PREFIXES,e=0,g=f.length;e<g;++e)c=f[e],(d=a.symbolizer[c])&&this.writeNode(c+"Symbolizer",d,b);return b},ElseFilter:function(){return this.createElementNSPlus("sld:ElseFilter")},MinScaleDenominator:function(a){return this.createElementNSPlus("sld:MinScaleDenominator",{value:a})},MaxScaleDenominator:function(a){return this.createElementNSPlus("sld:MaxScaleDenominator",{value:a})},LineSymbolizer:function(a){var b=this.createElementNSPlus("sld:LineSymbolizer");this.writeNode("Stroke",a,b);return b},Stroke:function(a){var b=this.createElementNSPlus("sld:Stroke");void 0!=a.strokeColor&&this.writeNode("CssParameter",{symbolizer:a,key:"strokeColor"},b);void 0!=a.strokeOpacity&&this.writeNode("CssParameter",{symbolizer:a,key:"strokeOpacity"},b);void 0!=a.strokeWidth&&this.writeNode("CssParameter",{symbolizer:a,key:"strokeWidth"},b);void 0!=a.strokeDashstyle&&"solid"!==a.strokeDashstyle&&this.writeNode("CssParameter",{symbolizer:a,key:"strokeDashstyle"},b);void 0!=a.strokeLinecap&&this.writeNode("CssParameter",{symbolizer:a,key:"strokeLinecap"},b);return b},CssParameter:function(a){return this.createElementNSPlus("sld:CssParameter",{attributes:{name:this.getCssProperty(a.key)},value:a.symbolizer[a.key]})},TextSymbolizer:function(a){var b=this.createElementNSPlus("sld:TextSymbolizer");null!=a.label&&this.writeNode("Label",a.label,b);(null!=a.fontFamily||null!=a.fontSize||null!=a.fontWeight||null!=a.fontStyle)&&this.writeNode("Font",a,b);(null!=a.labelAnchorPointX||null!=a.labelAnchorPointY||null!=a.labelAlign||null!=a.labelXOffset||null!=a.labelYOffset||null!=a.labelRotation||null!=a.labelPerpendicularOffset)&&this.writeNode("LabelPlacement",a,b);(null!=a.haloRadius||null!=a.haloColor||null!=a.haloOpacity)&&this.writeNode("Halo",a,b);(null!=a.fontColor||null!=a.fontOpacity)&&this.writeNode("Fill",{fillColor:a.fontColor,fillOpacity:a.fontOpacity},b);return b},LabelPlacement:function(a){var b=this.createElementNSPlus("sld:LabelPlacement");(null!=a.labelAnchorPointX||null!=a.labelAnchorPointY||null!=a.labelAlign||null!=a.labelXOffset||null!=a.labelYOffset||null!=a.labelRotation)&&null==a.labelPerpendicularOffset&&this.writeNode("PointPlacement",a,b);null!=a.labelPerpendicularOffset&&this.writeNode("LinePlacement",a,b);return b},LinePlacement:function(a){var b=this.createElementNSPlus("sld:LinePlacement");this.writeNode("PerpendicularOffset",a.labelPerpendicularOffset,b);return b},PerpendicularOffset:function(a){return this.createElementNSPlus("sld:PerpendicularOffset",{value:a})},PointPlacement:function(a){var b=this.createElementNSPlus("sld:PointPlacement");(null!=a.labelAnchorPointX||null!=a.labelAnchorPointY||null!=a.labelAlign)&&this.writeNode("AnchorPoint",a,b);(null!=a.labelXOffset||null!=a.labelYOffset)&&this.writeNode("Displacement",a,b);null!=a.labelRotation&&this.writeNode("Rotation",a.labelRotation,b);return b},AnchorPoint:function(a){var b=this.createElementNSPlus("sld:AnchorPoint"),c=a.labelAnchorPointX,d=a.labelAnchorPointY;null!=c&&this.writeNode("AnchorPointX",c,b);null!=d&&this.writeNode("AnchorPointY",d,b);if(null==c&&null==d){var e=a.labelAlign.substr(0,1),a=a.labelAlign.substr(1,1);"l"===e?c=0:"c"===e?c=.5:"r"===e&&(c=1);"b"===a?d=0:"m"===a?d=.5:"t"===a&&(d=1);this.writeNode("AnchorPointX",c,b);this.writeNode("AnchorPointY",d,b)}return b},AnchorPointX:function(a){return this.createElementNSPlus("sld:AnchorPointX",{value:a})},AnchorPointY:function(a){return this.createElementNSPlus("sld:AnchorPointY",{value:a})},Displacement:function(a){var b=this.createElementNSPlus("sld:Displacement");null!=a.labelXOffset&&this.writeNode("DisplacementX",a.labelXOffset,b);null!=a.labelYOffset&&this.writeNode("DisplacementY",a.labelYOffset,b);return b},DisplacementX:function(a){return this.createElementNSPlus("sld:DisplacementX",{value:a})},DisplacementY:function(a){return this.createElementNSPlus("sld:DisplacementY",{value:a})},Font:function(a){var b=this.createElementNSPlus("sld:Font");a.fontFamily&&this.writeNode("CssParameter",{symbolizer:a,key:"fontFamily"},b);a.fontSize&&this.writeNode("CssParameter",{symbolizer:a,key:"fontSize"},b);a.fontWeight&&this.writeNode("CssParameter",{symbolizer:a,key:"fontWeight"},b);a.fontStyle&&this.writeNode("CssParameter",{symbolizer:a,key:"fontStyle"},b);return b},Label:function(a){return this.writers.sld._OGCExpression.call(this,"sld:Label",a)},Halo:function(a){var b=this.createElementNSPlus("sld:Halo");a.haloRadius&&this.writeNode("Radius",a.haloRadius,b);(a.haloColor||a.haloOpacity)&&this.writeNode("Fill",{fillColor:a.haloColor,fillOpacity:a.haloOpacity},b);return b},Radius:function(a){return this.createElementNSPlus("sld:Radius",{value:a})},RasterSymbolizer:function(a){var b=this.createElementNSPlus("sld:RasterSymbolizer");a.geometry&&this.writeNode("Geometry",a.geometry,b);a.opacity&&this.writeNode("Opacity",a.opacity,b);a.colorMap&&this.writeNode("ColorMap",a.colorMap,b);return b},Geometry:function(a){var b=this.createElementNSPlus("sld:Geometry");a.property&&this.writeNode("ogc:PropertyName",a,b);return b},ColorMap:function(a){for(var b=this.createElementNSPlus("sld:ColorMap"),c=0,d=a.length;c<d;++c)this.writeNode("ColorMapEntry",a[c],b);return b},ColorMapEntry:function(a){var b=this.createElementNSPlus("sld:ColorMapEntry");b.setAttribute("color",a.color);void 0!==a.opacity&&b.setAttribute("opacity",parseFloat(a.opacity));void 0!==a.quantity&&b.setAttribute("quantity",parseFloat(a.quantity));void 0!==a.label&&b.setAttribute("label",a.label);return b},PolygonSymbolizer:function(a){var b=this.createElementNSPlus("sld:PolygonSymbolizer");!1!==a.fill&&this.writeNode("Fill",a,b);!1!==a.stroke&&this.writeNode("Stroke",a,b);return b},Fill:function(a){var b=this.createElementNSPlus("sld:Fill");a.fillColor&&this.writeNode("CssParameter",{symbolizer:a,key:"fillColor"},b);null!=a.fillOpacity&&this.writeNode("CssParameter",{symbolizer:a,key:"fillOpacity"},b);return b},PointSymbolizer:function(a){var b=this.createElementNSPlus("sld:PointSymbolizer");this.writeNode("Graphic",a,b);return b},Graphic:function(a){var b=this.createElementNSPlus("sld:Graphic");void 0!=a.externalGraphic?this.writeNode("ExternalGraphic",a,b):this.writeNode("Mark",a,b);void 0!=a.graphicOpacity&&this.writeNode("Opacity",a.graphicOpacity,b);void 0!=a.pointRadius?this.writeNode("Size",2*a.pointRadius,b):void 0!=a.graphicWidth&&this.writeNode("Size",a.graphicWidth,b);void 0!=a.rotation&&this.writeNode("Rotation",a.rotation,b);return b},ExternalGraphic:function(a){var b=this.createElementNSPlus("sld:ExternalGraphic");this.writeNode("OnlineResource",a.externalGraphic,b);this.writeNode("Format",a.graphicFormat||this.getGraphicFormat(a.externalGraphic),b);return b},Mark:function(a){var b=this.createElementNSPlus("sld:Mark");a.graphicName&&this.writeNode("WellKnownName",a.graphicName,b);!1!==a.fill&&this.writeNode("Fill",a,b);!1!==a.stroke&&this.writeNode("Stroke",a,b);return b},WellKnownName:function(a){return this.createElementNSPlus("sld:WellKnownName",{value:a})},Opacity:function(a){return this.createElementNSPlus("sld:Opacity",{value:a})},Size:function(a){return this.writers.sld._OGCExpression.call(this,"sld:Size",a)},Rotation:function(a){return this.createElementNSPlus("sld:Rotation",{value:a})},OnlineResource:function(a){return this.createElementNSPlus("sld:OnlineResource",{attributes:{"xlink:type":"simple","xlink:href":a}})},Format:function(a){return this.createElementNSPlus("sld:Format",{value:a})}}},OpenLayers.Format.Filter.v1_0_0.prototype.writers),CLASS_NAME:"OpenLayers.Format.SLD.v1"});OpenLayers.Layer.WMS=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/jpeg"},isBaseLayer:!0,encodeBBOX:!1,noMagic:!1,yx:{},initialize:function(a,b,c,d){var e=[],c=OpenLayers.Util.upperCaseObject(c);1.3<=parseFloat(c.VERSION)&&!c.EXCEPTIONS&&(c.EXCEPTIONS="INIMAGE");e.push(a,b,c,d);OpenLayers.Layer.Grid.prototype.initialize.apply(this,e);OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));if(!this.noMagic&&this.params.TRANSPARENT&&"true"==this.params.TRANSPARENT.toString().toLowerCase()){if(null==d||!d.isBaseLayer)this.isBaseLayer=!1;"image/jpeg"==this.params.FORMAT&&(this.params.FORMAT=OpenLayers.Util.alphaHack()?"image/gif":"image/png")}},clone:function(a){null==a&&(a=new OpenLayers.Layer.WMS(this.name,this.url,this.params,this.getOptions()));return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a])},reverseAxisOrder:function(){var a=this.projection.getCode();return 1.3<=parseFloat(this.params.VERSION)&&!(!this.yx[a]&&!OpenLayers.Projection.defaults[a].yx)},getURL:function(a){var a=this.adjustBounds(a),b=this.getImageSize(),c={},d=this.reverseAxisOrder();c.BBOX=this.encodeBBOX?a.toBBOX(null,d):a.toArray(d);c.WIDTH=b.w;c.HEIGHT=b.h;return this.getFullRequestString(c)},mergeNewParams:function(a){a=[OpenLayers.Util.upperCaseObject(a)];return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,a)},getFullRequestString:function(a,b){var c=this.map.getProjectionObject(),c=this.projection&&this.projection.equals(c)?this.projection.getCode():c.getCode(),c="none"==c?null:c;1.3<=parseFloat(this.params.VERSION)?this.params.CRS=c:this.params.SRS=c;"boolean"==typeof this.params.TRANSPARENT&&(a.TRANSPARENT=this.params.TRANSPARENT?"TRUE":"FALSE");return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments)},CLASS_NAME:"OpenLayers.Layer.WMS"});OpenLayers.Format.WMC.v1_1_0=OpenLayers.Class(OpenLayers.Format.WMC.v1,{VERSION:"1.1.0",schemaLocation:"http://www.opengis.net/context http://schemas.opengis.net/context/1.1.0/context.xsd",initialize:function(a){OpenLayers.Format.WMC.v1.prototype.initialize.apply(this,[a])},read_sld_MinScaleDenominator:function(a,b){var c=parseFloat(this.getChildValue(b));0<c&&(a.maxScale=c)},read_sld_MaxScaleDenominator:function(a,b){a.minScale=parseFloat(this.getChildValue(b))},read_wmc_SRS:function(a,b){"srs"in a||(a.srs={});a.srs[this.getChildValue(b)]=!0},write_wmc_Layer:function(a){var b=OpenLayers.Format.WMC.v1.prototype.write_wmc_Layer.apply(this,[a]);if(a.maxScale){var c=this.createElementNS(this.namespaces.sld,"sld:MinScaleDenominator");c.appendChild(this.createTextNode(a.maxScale.toPrecision(16)));b.appendChild(c)}a.minScale&&(c=this.createElementNS(this.namespaces.sld,"sld:MaxScaleDenominator"),c.appendChild(this.createTextNode(a.minScale.toPrecision(16))),b.appendChild(c));if(a.srs)for(var d in a.srs)b.appendChild(this.createElementDefaultNS("SRS",d));b.appendChild(this.write_wmc_FormatList(a));b.appendChild(this.write_wmc_StyleList(a));a.dimensions&&b.appendChild(this.write_wmc_DimensionList(a));b.appendChild(this.write_wmc_LayerExtension(a));return b},CLASS_NAME:"OpenLayers.Format.WMC.v1_1_0"});OpenLayers.Format.XLS=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{defaultVersion:"1.1.0",stringifyOutput:!0,CLASS_NAME:"OpenLayers.Format.XLS"});OpenLayers.Format.XLS.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{xls:"http://www.opengis.net/xls",gml:"http://www.opengis.net/gml",xsi:"http://www.w3.org/2001/XMLSchema-instance"},regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},xy:!0,defaultPrefix:"xls",schemaLocation:null,read:function(a,b){OpenLayers.Util.applyDefaults(b,this.options);var c={};this.readChildNodes(a,c);return c},readers:{xls:{XLS:function(a,b){b.version=a.getAttribute("version");this.readChildNodes(a,b)},Response:function(a,b){this.readChildNodes(a,b)},GeocodeResponse:function(a,b){b.responseLists=[];this.readChildNodes(a,b)},GeocodeResponseList:function(a,b){var c={features:[],numberOfGeocodedAddresses:parseInt(a.getAttribute("numberOfGeocodedAddresses"))};b.responseLists.push(c);this.readChildNodes(a,c)},GeocodedAddress:function(a,b){var c=new OpenLayers.Feature.Vector;b.features.push(c);this.readChildNodes(a,c);c.geometry=c.components[0]},GeocodeMatchCode:function(a,b){b.attributes.matchCode={accuracy:parseFloat(a.getAttribute("accuracy")),matchType:a.getAttribute("matchType")}},Address:function(a,b){var c={countryCode:a.getAttribute("countryCode"),addressee:a.getAttribute("addressee"),street:[],place:[]};b.attributes.address=c;this.readChildNodes(a,c)},freeFormAddress:function(a,b){b.freeFormAddress=this.getChildValue(a)},StreetAddress:function(a,b){this.readChildNodes(a,b)},Building:function(a,b){b.building={number:a.getAttribute("number"),subdivision:a.getAttribute("subdivision"),buildingName:a.getAttribute("buildingName")}},Street:function(a,b){b.street.push(this.getChildValue(a))},Place:function(a,b){b.place[a.getAttribute("type")]=this.getChildValue(a)},PostalCode:function(a,b){b.postalCode=this.getChildValue(a)}},gml:OpenLayers.Format.GML.v3.prototype.readers.gml},write:function(a){return this.writers.xls.XLS.apply(this,[a])},writers:{xls:{XLS:function(a){var b=this.createElementNSPlus("xls:XLS",{attributes:{version:this.VERSION,"xsi:schemaLocation":this.schemaLocation}});this.writeNode("RequestHeader",a.header,b);this.writeNode("Request",a,b);return b},RequestHeader:function(){return this.createElementNSPlus("xls:RequestHeader")},Request:function(a){var b=this.createElementNSPlus("xls:Request",{attributes:{methodName:"GeocodeRequest",requestID:a.requestID||"",version:this.VERSION}});this.writeNode("GeocodeRequest",a.addresses,b);return b},GeocodeRequest:function(a){for(var b=this.createElementNSPlus("xls:GeocodeRequest"),c=0,d=a.length;c<d;c++)this.writeNode("Address",a[c],b);return b},Address:function(a){var b=this.createElementNSPlus("xls:Address",{attributes:{countryCode:a.countryCode}});a.freeFormAddress?this.writeNode("freeFormAddress",a.freeFormAddress,b):(a.street&&this.writeNode("StreetAddress",a,b),a.municipality&&this.writeNode("Municipality",a.municipality,b),a.countrySubdivision&&this.writeNode("CountrySubdivision",a.countrySubdivision,b),a.postalCode&&this.writeNode("PostalCode",a.postalCode,b));return b},freeFormAddress:function(a){return this.createElementNSPlus("freeFormAddress",{value:a})},StreetAddress:function(a){var b=this.createElementNSPlus("xls:StreetAddress");a.building&&this.writeNode(b,"Building",a.building);a=a.street;OpenLayers.Util.isArray(a)||(a=[a]);for(var c=0,d=a.length;c<d;c++)this.writeNode("Street",a[c],b);return b},Building:function(a){return this.createElementNSPlus("xls:Building",{attributes:{number:a.number,subdivision:a.subdivision,buildingName:a.buildingName}})},Street:function(a){return this.createElementNSPlus("xls:Street",{value:a})},Municipality:function(a){return this.createElementNSPlus("xls:Place",{attributes:{type:"Municipality"},value:a})},CountrySubdivision:function(a){return this.createElementNSPlus("xls:Place",{attributes:{type:"CountrySubdivision"},value:a})},PostalCode:function(a){return this.createElementNSPlus("xls:PostalCode",{value:a})}}},CLASS_NAME:"OpenLayers.Format.XLS.v1"});OpenLayers.Format.XLS.v1_1_0=OpenLayers.Class(OpenLayers.Format.XLS.v1,{VERSION:"1.1",schemaLocation:"http://www.opengis.net/xls http://schemas.opengis.net/ols/1.1.0/LocationUtilityService.xsd",CLASS_NAME:"OpenLayers.Format.XLS.v1_1_0"});OpenLayers.Format.XLS.v1_1=OpenLayers.Format.XLS.v1_1_0;OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15e3,translationParameters:null,symbolMetrics:null,initialize:function(a){this.supported()&&(OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments),this.translationParameters={x:0,y:0},this.symbolMetrics={})},supported:function(){return document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#SVG","1.1")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"))},inValidRange:function(a,b,c){a+=c?0:this.translationParameters.x;b+=c?0:this.translationParameters.y;return a>=-this.MAX_PIXEL&&a<=this.MAX_PIXEL&&b>=-this.MAX_PIXEL&&b<=this.MAX_PIXEL},setExtent:function(a,b){var c=OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments),d=this.getResolution(),e=-a.left/d,d=a.top/d;if(b)return this.left=e,this.top=d,this.rendererRoot.setAttributeNS(null,"viewBox","0 0 "+this.size.w+" "+this.size.h),this.translate(this.xOffset,0),!0;(e=this.translate(e-this.left+this.xOffset,d-this.top))||this.setExtent(a,!0);return c&&e},translate:function(a,b){if(this.inValidRange(a,b,!0)){var c="";if(a||b)c="translate("+a+","+b+")";this.root.setAttributeNS(null,"transform",c);this.translationParameters={x:a,y:b};return!0}return!1},setSize:function(a){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);this.rendererRoot.setAttributeNS(null,"height",this.size.h)},getNodeType:function(a,b){var c=null;switch(a.CLASS_NAME){case"OpenLayers.Geometry.Point":c=b.externalGraphic?"image":this.isComplexSymbol(b.graphicName)?"svg":"circle";break;case"OpenLayers.Geometry.Rectangle":c="rect";break;case"OpenLayers.Geometry.LineString":c="polyline";break;case"OpenLayers.Geometry.LinearRing":c="polygon";break;case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":c="path"}return c},setStyle:function(a,b,c){var b=b||a._style,c=c||a._options,d=parseFloat(a.getAttributeNS(null,"r")),e=1,f;if("OpenLayers.Geometry.Point"==a._geometryClass&&d){a.style.visibility="";if(!1===b.graphic)a.style.visibility="hidden";else if(b.externalGraphic){f=this.getPosition(a);b.graphicTitle&&(a.setAttributeNS(null,"title",b.graphicTitle),d=a.getElementsByTagName("title"),0<d.length?d[0].firstChild.textContent=b.graphicTitle:(d=this.nodeFactory(null,"title"),d.textContent=b.graphicTitle,a.appendChild(d)));b.graphicWidth&&b.graphicHeight&&a.setAttributeNS(null,"preserveAspectRatio","none");var d=b.graphicWidth||b.graphicHeight,g=b.graphicHeight||b.graphicWidth,d=d?d:2*b.pointRadius,g=g?g:2*b.pointRadius,h=void 0!=b.graphicYOffset?b.graphicYOffset:-(.5*g),i=b.graphicOpacity||b.fillOpacity;a.setAttributeNS(null,"x",(f.x+(void 0!=b.graphicXOffset?b.graphicXOffset:-(.5*d))).toFixed());a.setAttributeNS(null,"y",(f.y+h).toFixed());a.setAttributeNS(null,"width",d);a.setAttributeNS(null,"height",g);a.setAttributeNS(this.xlinkns,"href",b.externalGraphic);a.setAttributeNS(null,"style","opacity: "+i);a.onclick=OpenLayers.Renderer.SVG.preventDefault}else if(this.isComplexSymbol(b.graphicName)){var d=3*b.pointRadius,g=2*d,j=this.importSymbol(b.graphicName);f=this.getPosition(a);e=3*this.symbolMetrics[j.id][0]/g;h=a.parentNode;i=a.nextSibling;h&&h.removeChild(a);a.firstChild&&a.removeChild(a.firstChild);a.appendChild(j.firstChild.cloneNode(!0));a.setAttributeNS(null,"viewBox",j.getAttributeNS(null,"viewBox"));a.setAttributeNS(null,"width",g);a.setAttributeNS(null,"height",g);a.setAttributeNS(null,"x",f.x-d);a.setAttributeNS(null,"y",f.y-d);i?h.insertBefore(a,i):h&&h.appendChild(a)}else a.setAttributeNS(null,"r",b.pointRadius);d=b.rotation;if((void 0!==d||void 0!==a._rotation)&&f)a._rotation=d,d|=0,"svg"!==a.nodeName?a.setAttributeNS(null,"transform","rotate("+d+" "+f.x+" "+f.y+")"):(f=this.symbolMetrics[j.id],a.firstChild.setAttributeNS(null,"transform","rotate("+d+" "+f[1]+" "+f[2]+")"))}c.isFilled?(a.setAttributeNS(null,"fill",b.fillColor),a.setAttributeNS(null,"fill-opacity",b.fillOpacity)):a.setAttributeNS(null,"fill","none");c.isStroked?(a.setAttributeNS(null,"stroke",b.strokeColor),a.setAttributeNS(null,"stroke-opacity",b.strokeOpacity),a.setAttributeNS(null,"stroke-width",b.strokeWidth*e),a.setAttributeNS(null,"stroke-linecap",b.strokeLinecap||"round"),a.setAttributeNS(null,"stroke-linejoin","round"),b.strokeDashstyle&&a.setAttributeNS(null,"stroke-dasharray",this.dashStyle(b,e))):a.setAttributeNS(null,"stroke","none");b.pointerEvents&&a.setAttributeNS(null,"pointer-events",b.pointerEvents);null!=b.cursor&&a.setAttributeNS(null,"cursor",b.cursor);return a},dashStyle:function(a,b){var c=a.strokeWidth*b,d=a.strokeDashstyle;switch(d){case"solid":return"none";case"dot":return[1,4*c].join();case"dash":return[4*c,4*c].join();case"dashdot":return[4*c,4*c,1,4*c].join();case"longdash":return[8*c,4*c].join();case"longdashdot":return[8*c,4*c,1,4*c].join();default:return OpenLayers.String.trim(d).replace(/\s+/g,",")}},createNode:function(a,b){var c=document.createElementNS(this.xmlns,a);b&&c.setAttributeNS(null,"id",b);return c},nodeTypeCompare:function(a,b){return b==a.nodeName},createRenderRoot:function(){var a=this.nodeFactory(this.container.id+"_svgRoot","svg");a.style.display="block";return a},createRoot:function(a){return this.nodeFactory(this.container.id+a,"g")},createDefs:function(){var a=this.nodeFactory(this.container.id+"_defs","defs");this.rendererRoot.appendChild(a);return a},drawPoint:function(a,b){return this.drawCircle(a,b,1)},drawCircle:function(a,b,c){var d=this.getResolution(),e=(b.x-this.featureDx)/d+this.left,b=this.top-b.y/d;return this.inValidRange(e,b)?(a.setAttributeNS(null,"cx",e),a.setAttributeNS(null,"cy",b),a.setAttributeNS(null,"r",c),a):!1},drawLineString:function(a,b){var c=this.getComponentsString(b.components);return c.path?(a.setAttributeNS(null,"points",c.path),c.complete?a:null):!1},drawLinearRing:function(a,b){var c=this.getComponentsString(b.components);return c.path?(a.setAttributeNS(null,"points",c.path),c.complete?a:null):!1},drawPolygon:function(a,b){for(var c="",d=!0,e=!0,f,g,h=0,i=b.components.length;h<i;h++)c+=" M",f=this.getComponentsString(b.components[h].components," "),(g=f.path)?(c+=" "+g,e=f.complete&&e):d=!1;return d?(a.setAttributeNS(null,"d",c+" z"),a.setAttributeNS(null,"fill-rule","evenodd"),e?a:null):!1},drawRectangle:function(a,b){var c=this.getResolution(),d=(b.x-this.featureDx)/c+this.left,e=this.top-b.y/c;return this.inValidRange(d,e)?(a.setAttributeNS(null,"x",d),a.setAttributeNS(null,"y",e),a.setAttributeNS(null,"width",b.width/c),a.setAttributeNS(null,"height",b.height/c),a):!1},drawText:function(a,b,c){var d=!!b.labelOutlineWidth;if(d){var e=OpenLayers.Util.extend({},b);e.fontColor=e.labelOutlineColor;e.fontStrokeColor=e.labelOutlineColor;e.fontStrokeWidth=b.labelOutlineWidth;delete e.labelOutlineWidth;this.drawText(a,e,c)}var f=this.getResolution(),e=(c.x-this.featureDx)/f+this.left,g=c.y/f-this.top,d=d?this.LABEL_OUTLINE_SUFFIX:this.LABEL_ID_SUFFIX,f=this.nodeFactory(a+d,"text");f.setAttributeNS(null,"x",e);f.setAttributeNS(null,"y",-g);b.fontColor&&f.setAttributeNS(null,"fill",b.fontColor);b.fontStrokeColor&&f.setAttributeNS(null,"stroke",b.fontStrokeColor);b.fontStrokeWidth&&f.setAttributeNS(null,"stroke-width",b.fontStrokeWidth);b.fontOpacity&&f.setAttributeNS(null,"opacity",b.fontOpacity);b.fontFamily&&f.setAttributeNS(null,"font-family",b.fontFamily);b.fontSize&&f.setAttributeNS(null,"font-size",b.fontSize);b.fontWeight&&f.setAttributeNS(null,"font-weight",b.fontWeight);b.fontStyle&&f.setAttributeNS(null,"font-style",b.fontStyle);!0===b.labelSelect?(f.setAttributeNS(null,"pointer-events","visible"),f._featureId=a):f.setAttributeNS(null,"pointer-events","none");g=b.labelAlign||OpenLayers.Renderer.defaultSymbolizer.labelAlign;f.setAttributeNS(null,"text-anchor",OpenLayers.Renderer.SVG.LABEL_ALIGN[g[0]]||"middle");!0===OpenLayers.IS_GECKO&&f.setAttributeNS(null,"dominant-baseline",OpenLayers.Renderer.SVG.LABEL_ALIGN[g[1]]||"central");for(var h=b.label.split("\n"),i=h.length;f.childNodes.length>i;)f.removeChild(f.lastChild);for(var j=0;j<i;j++){var k=this.nodeFactory(a+d+"_tspan_"+j,"tspan");!0===b.labelSelect&&(k._featureId=a,k._geometry=c,k._geometryClass=c.CLASS_NAME);!1===OpenLayers.IS_GECKO&&k.setAttributeNS(null,"baseline-shift",OpenLayers.Renderer.SVG.LABEL_VSHIFT[g[1]]||"-35%");k.setAttribute("x",e);if(0==j){var l=OpenLayers.Renderer.SVG.LABEL_VFACTOR[g[1]];null==l&&(l=-.5);k.setAttribute("dy",l*(i-1)+"em")}else k.setAttribute("dy","1em");k.textContent=""===h[j]?" ":h[j];k.parentNode||f.appendChild(k)}f.parentNode||this.textRoot.appendChild(f)},getComponentsString:function(a,b){for(var c=[],d=!0,e=a.length,f=[],g,h=0;h<e;h++)g=a[h],c.push(g),(g=this.getShortString(g))?f.push(g):(0<h&&this.getShortString(a[h-1])&&f.push(this.clipLine(a[h],a[h-1])),h<e-1&&this.getShortString(a[h+1])&&f.push(this.clipLine(a[h],a[h+1])),d=!1);return{path:f.join(b||","),complete:d}},clipLine:function(a,b){if(b.equals(a))return"";var c=this.getResolution(),d=this.MAX_PIXEL-this.translationParameters.x,e=this.MAX_PIXEL-this.translationParameters.y,f=(b.x-this.featureDx)/c+this.left,g=this.top-b.y/c,h=(a.x-this.featureDx)/c+this.left,c=this.top-a.y/c,i;if(h<-d||h>d)i=(c-g)/(h-f),h=0>h?-d:d,c=g+(h-f)*i;if(c<-e||c>e)i=(h-f)/(c-g),c=0>c?-e:e,h=f+(c-g)*i;return h+","+c},getShortString:function(a){var b=this.getResolution(),c=(a.x-this.featureDx)/b+this.left,a=this.top-a.y/b;return this.inValidRange(c,a)?c+","+a:!1},getPosition:function(a){return{x:parseFloat(a.getAttributeNS(null,"cx")),y:parseFloat(a.getAttributeNS(null,"cy"))}},importSymbol:function(a){this.defs||(this.defs=this.createDefs());var b=this.container.id+"-"+a,c=document.getElementById(b);if(null!=c)return c;var d=OpenLayers.Renderer.symbol[a];if(!d)throw Error(a+" is not a valid symbol name");var a=this.nodeFactory(b,"symbol"),e=this.nodeFactory(null,"polygon");a.appendChild(e);for(var c=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0),f=[],g,h,i=0;i<d.length;i+=2)g=d[i],h=d[i+1],c.left=Math.min(c.left,g),c.bottom=Math.min(c.bottom,h),c.right=Math.max(c.right,g),c.top=Math.max(c.top,h),f.push(g,",",h);e.setAttributeNS(null,"points",f.join(" "));d=c.getWidth();e=c.getHeight();a.setAttributeNS(null,"viewBox",[c.left-d,c.bottom-e,3*d,3*e].join(" "));this.symbolMetrics[b]=[Math.max(d,e),c.getCenterLonLat().lon,c.getCenterLonLat().lat];this.defs.appendChild(a);return a},getFeatureIdFromEvent:function(a){var b=OpenLayers.Renderer.Elements.prototype.getFeatureIdFromEvent.apply(this,arguments);b||(b=a.target,b=b.parentNode&&b!=this.rendererRoot?b.parentNode._featureId:void 0);return b},CLASS_NAME:"OpenLayers.Renderer.SVG"});OpenLayers.Renderer.SVG.LABEL_ALIGN={l:"start",r:"end",b:"bottom",t:"hanging"};OpenLayers.Renderer.SVG.LABEL_VSHIFT={t:"-70%",b:"0"};OpenLayers.Renderer.SVG.LABEL_VFACTOR={t:0,b:-1};OpenLayers.Renderer.SVG.preventDefault=function(a){a.preventDefault&&a.preventDefault()};OpenLayers.Format.SLD.v1_0_0=OpenLayers.Class(OpenLayers.Format.SLD.v1,{VERSION:"1.0.0",schemaLocation:"http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd",CLASS_NAME:"OpenLayers.Format.SLD.v1_0_0"});OpenLayers.Format.OWSContext=OpenLayers.Class(OpenLayers.Format.Context,{defaultVersion:"0.3.1",getVersion:function(a,b){var c=OpenLayers.Format.XML.VersionedOGC.prototype.getVersion.apply(this,arguments);"0.3.0"===c&&(c=this.defaultVersion);return c},toContext:function(a){var b={};"OpenLayers.Map"==a.CLASS_NAME&&(b.bounds=a.getExtent(),b.maxExtent=a.maxExtent,b.projection=a.projection,b.size=a.getSize(),
b.layers=a.layers);return b},CLASS_NAME:"OpenLayers.Format.OWSContext"});OpenLayers.Format.OWSContext.v0_3_1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{owc:"http://www.opengis.net/ows-context",gml:"http://www.opengis.net/gml",kml:"http://www.opengis.net/kml/2.2",ogc:"http://www.opengis.net/ogc",ows:"http://www.opengis.net/ows",sld:"http://www.opengis.net/sld",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},VERSION:"0.3.1",schemaLocation:"http://www.opengis.net/ows-context http://www.ogcnetwork.net/schemas/owc/0.3.1/owsContext.xsd",defaultPrefix:"owc",extractAttributes:!0,xy:!0,regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},featureNS:"http://mapserver.gis.umn.edu/mapserver",featureType:"vector",geometryName:"geometry",nestingLayerLookup:null,initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a]);OpenLayers.Format.GML.v2.prototype.setGeometryTypes.call(this)},setNestingPath:function(a){if(a.layersContext)for(var b=0,c=a.layersContext.length;b<c;b++){var d=a.layersContext[b],e=[],f=a.title||"";a.metadata&&a.metadata.nestingPath&&(e=a.metadata.nestingPath.slice());""!=f&&e.push(f);d.metadata.nestingPath=e;d.layersContext&&this.setNestingPath(d)}},decomposeNestingPath:function(a){var b=[];if(OpenLayers.Util.isArray(a)){for(a=a.slice();0<a.length;)b.push(a.slice()),a.pop();b.reverse()}return b},read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a&&9==a.nodeType&&(a=a.documentElement);var b={};this.readNode(a,b);this.setNestingPath({layersContext:b.layersContext});a=[];this.processLayer(a,b);delete b.layersContext;b.layersContext=a;return b},processLayer:function(a,b){if(b.layersContext)for(var c=0,d=b.layersContext.length;c<d;c++){var e=b.layersContext[c];a.push(e);e.layersContext&&this.processLayer(a,e)}},write:function(a,b){this.nestingLayerLookup={};b=b||{};OpenLayers.Util.applyDefaults(b,a);var c=this.writeNode("OWSContext",b);this.nestingLayerLookup=null;this.setAttributeNS(c,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[c])},readers:{kml:{Document:function(a,b){b.features=new OpenLayers.Format.KML({kmlns:this.namespaces.kml,extractStyles:!0}).read(a)}},owc:{OWSContext:function(a,b){this.readChildNodes(a,b)},General:function(a,b){this.readChildNodes(a,b)},ResourceList:function(a,b){this.readChildNodes(a,b)},Layer:function(a,b){var c={metadata:{},visibility:"1"!=a.getAttribute("hidden"),queryable:"1"==a.getAttribute("queryable"),opacity:null!=a.getAttribute("opacity")?parseFloat(a.getAttribute("opacity")):null,name:a.getAttribute("name"),categoryLayer:null==a.getAttribute("name"),formats:[],styles:[]};b.layersContext||(b.layersContext=[]);b.layersContext.push(c);this.readChildNodes(a,c)},InlineGeometry:function(a,b){b.features=[];var c=this.getElementsByTagNameNS(a,this.namespaces.gml,"featureMember"),d;1<=c.length&&(d=c[0]);d&&d.firstChild&&(c=d.firstChild.nextSibling?d.firstChild.nextSibling:d.firstChild,this.setNamespace("feature",c.namespaceURI),this.featureType=c.localName||c.nodeName.split(":").pop(),this.readChildNodes(a,b))},Server:function(a,b){if(!b.service&&!b.version||b.service!=OpenLayers.Format.Context.serviceTypes.WMS)b.service=a.getAttribute("service"),b.version=a.getAttribute("version"),this.readChildNodes(a,b)},Name:function(a,b){b.name=this.getChildValue(a);this.readChildNodes(a,b)},Title:function(a,b){b.title=this.getChildValue(a);this.readChildNodes(a,b)},StyleList:function(a,b){this.readChildNodes(a,b.styles)},Style:function(a,b){var c={};b.push(c);this.readChildNodes(a,c)},LegendURL:function(a,b){var c={};b.legend=c;this.readChildNodes(a,c)},OnlineResource:function(a,b){b.url=this.getAttributeNS(a,this.namespaces.xlink,"href");this.readChildNodes(a,b)}},ows:OpenLayers.Format.OWSCommon.v1_0_0.prototype.readers.ows,gml:OpenLayers.Format.GML.v2.prototype.readers.gml,sld:OpenLayers.Format.SLD.v1_0_0.prototype.readers.sld,feature:OpenLayers.Format.GML.v2.prototype.readers.feature},writers:{owc:{OWSContext:function(a){var b=this.createElementNSPlus("OWSContext",{attributes:{version:this.VERSION,id:a.id||OpenLayers.Util.createUniqueID("OpenLayers_OWSContext_")}});this.writeNode("General",a,b);this.writeNode("ResourceList",a,b);return b},General:function(a){var b=this.createElementNSPlus("General");this.writeNode("ows:BoundingBox",a,b);this.writeNode("ows:Title",a.title||"OpenLayers OWSContext",b);return b},ResourceList:function(a){for(var b=this.createElementNSPlus("ResourceList"),c=0,d=a.layers.length;c<d;c++){var e=a.layers[c],f=this.decomposeNestingPath(e.metadata.nestingPath);this.writeNode("_Layer",{layer:e,subPaths:f},b)}return b},Server:function(a){var b=this.createElementNSPlus("Server",{attributes:{version:a.version,service:a.service}});this.writeNode("OnlineResource",a,b);return b},OnlineResource:function(a){return this.createElementNSPlus("OnlineResource",{attributes:{"xlink:href":a.url}})},InlineGeometry:function(a){var b=this.createElementNSPlus("InlineGeometry");this.writeNode("gml:boundedBy",a.getDataExtent(),b);for(var c=0,d=a.features.length;c<d;c++)this.writeNode("gml:featureMember",a.features[c],b);return b},StyleList:function(a){for(var b=this.createElementNSPlus("StyleList"),c=0,d=a.length;c<d;c++)this.writeNode("Style",a[c],b);return b},Style:function(a){var b=this.createElementNSPlus("Style");this.writeNode("Name",a,b);this.writeNode("Title",a,b);a.legend&&this.writeNode("LegendURL",a,b);return b},Name:function(a){return this.createElementNSPlus("Name",{value:a.name})},Title:function(a){return this.createElementNSPlus("Title",{value:a.title})},LegendURL:function(a){var b=this.createElementNSPlus("LegendURL");this.writeNode("OnlineResource",a.legend,b);return b},_WMS:function(a){var b=this.createElementNSPlus("Layer",{attributes:{name:a.params.LAYERS,queryable:a.queryable?"1":"0",hidden:a.visibility?"0":"1",opacity:a.hasOwnProperty("opacity")?a.opacity:null}});this.writeNode("ows:Title",a.name,b);this.writeNode("ows:OutputFormat",a.params.FORMAT,b);this.writeNode("Server",{service:OpenLayers.Format.Context.serviceTypes.WMS,version:a.params.VERSION,url:a.url},b);a.metadata.styles&&0<a.metadata.styles.length&&this.writeNode("StyleList",a.metadata.styles,b);return b},_Layer:function(a){var b,c,d;b=a.layer;c=a.subPaths;d=null;0<c.length?(b=c[0].join("/"),c=b.lastIndexOf("/"),d=this.nestingLayerLookup[b],c=0<c?b.substring(c+1,b.length):b,d||(d=this.createElementNSPlus("Layer"),this.writeNode("ows:Title",c,d),this.nestingLayerLookup[b]=d),a.subPaths.shift(),this.writeNode("_Layer",a,d)):(b instanceof OpenLayers.Layer.WMS?d=this.writeNode("_WMS",b):b instanceof OpenLayers.Layer.Vector&&(b.protocol instanceof OpenLayers.Protocol.WFS.v1?d=this.writeNode("_WFS",b):b.protocol instanceof OpenLayers.Protocol.HTTP?b.protocol.format instanceof OpenLayers.Format.GML?(b.protocol.format.version="2.1.2",d=this.writeNode("_GML",b)):b.protocol.format instanceof OpenLayers.Format.KML&&(b.protocol.format.version="2.2",d=this.writeNode("_KML",b)):(this.setNamespace("feature",this.featureNS),d=this.writeNode("_InlineGeometry",b))),b.options.maxScale&&this.writeNode("sld:MinScaleDenominator",b.options.maxScale,d),b.options.minScale&&this.writeNode("sld:MaxScaleDenominator",b.options.minScale,d),this.nestingLayerLookup[b.name]=d);return d},_WFS:function(a){var b=this.createElementNSPlus("Layer",{attributes:{name:a.protocol.featurePrefix+":"+a.protocol.featureType,hidden:a.visibility?"0":"1"}});this.writeNode("ows:Title",a.name,b);this.writeNode("Server",{service:OpenLayers.Format.Context.serviceTypes.WFS,version:a.protocol.version,url:a.protocol.url},b);return b},_InlineGeometry:function(a){var b=this.createElementNSPlus("Layer",{attributes:{name:this.featureType,hidden:a.visibility?"0":"1"}});this.writeNode("ows:Title",a.name,b);this.writeNode("InlineGeometry",a,b);return b},_GML:function(a){var b=this.createElementNSPlus("Layer");this.writeNode("ows:Title",a.name,b);this.writeNode("Server",{service:OpenLayers.Format.Context.serviceTypes.GML,url:a.protocol.url,version:a.protocol.format.version},b);return b},_KML:function(a){var b=this.createElementNSPlus("Layer");this.writeNode("ows:Title",a.name,b);this.writeNode("Server",{service:OpenLayers.Format.Context.serviceTypes.KML,version:a.protocol.format.version,url:a.protocol.url},b);return b}},gml:OpenLayers.Util.applyDefaults({boundedBy:function(a){var b=this.createElementNSPlus("gml:boundedBy");this.writeNode("gml:Box",a,b);return b}},OpenLayers.Format.GML.v2.prototype.writers.gml),ows:OpenLayers.Format.OWSCommon.v1_0_0.prototype.writers.ows,sld:OpenLayers.Format.SLD.v1_0_0.prototype.writers.sld,feature:OpenLayers.Format.GML.v2.prototype.writers.feature},CLASS_NAME:"OpenLayers.Format.OWSContext.v0_3_1"});OpenLayers.Control.ScaleLine=OpenLayers.Class(OpenLayers.Control,{maxWidth:100,topOutUnits:"km",topInUnits:"m",bottomOutUnits:"mi",bottomInUnits:"ft",eTop:null,eBottom:null,geodesic:!1,draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.eTop||(this.eTop=document.createElement("div"),this.eTop.className=this.displayClass+"Top",this.div.appendChild(this.eTop),this.eTop.style.visibility=""==this.topOutUnits||""==this.topInUnits?"hidden":"visible",this.eBottom=document.createElement("div"),this.eBottom.className=this.displayClass+"Bottom",this.div.appendChild(this.eBottom),this.eBottom.style.visibility=""==this.bottomOutUnits||""==this.bottomInUnits?"hidden":"visible");this.map.events.register("moveend",this,this.update);this.update();return this.div},getBarLen:function(a){var b=parseInt(Math.log(a)/Math.log(10)),b=Math.pow(10,b),a=parseInt(a/b);return(5<a?5:2<a?2:1)*b},update:function(){var a=this.map.getResolution();if(a){var b=this.map.getUnits(),c=OpenLayers.INCHES_PER_UNIT,d=this.maxWidth*a*c[b],e=1;!0===this.geodesic&&(e=(this.map.getGeodesicPixelSize().w||1e-6)*this.maxWidth/(d/c.km),d*=e);var f,g;1e5<d?(f=this.topOutUnits,g=this.bottomOutUnits):(f=this.topInUnits,g=this.bottomInUnits);var h=d/c[f],i=d/c[g],d=this.getBarLen(h),j=this.getBarLen(i),h=d/c[b]*c[f],i=j/c[b]*c[g],b=h/a/e,a=i/a/e;"visible"==this.eBottom.style.visibility&&(this.eBottom.style.width=Math.round(a)+"px",this.eBottom.innerHTML=j+" "+g);"visible"==this.eTop.style.visibility&&(this.eTop.style.width=Math.round(b)+"px",this.eTop.innerHTML=d+" "+f)}},CLASS_NAME:"OpenLayers.Control.ScaleLine"});OpenLayers.Icon=OpenLayers.Class({url:null,size:null,offset:null,calculateOffset:null,imageDiv:null,px:null,initialize:function(a,b,c,d){this.url=a;this.size=b||{w:20,h:20};this.offset=c||{x:-(this.size.w/2),y:-(this.size.h/2)};this.calculateOffset=d;a=OpenLayers.Util.createUniqueID("OL_Icon_");this.imageDiv=OpenLayers.Util.createAlphaImageDiv(a)},destroy:function(){this.erase();OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);this.imageDiv.innerHTML="";this.imageDiv=null},clone:function(){return new OpenLayers.Icon(this.url,this.size,this.offset,this.calculateOffset)},setSize:function(a){null!=a&&(this.size=a);this.draw()},setUrl:function(a){null!=a&&(this.url=a);this.draw()},draw:function(a){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,this.size,this.url,"absolute");this.moveTo(a);return this.imageDiv},erase:function(){null!=this.imageDiv&&null!=this.imageDiv.parentNode&&OpenLayers.Element.remove(this.imageDiv)},setOpacity:function(a){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,null,null,null,null,null,a)},moveTo:function(a){null!=a&&(this.px=a);null!=this.imageDiv&&(null==this.px?this.display(!1):(this.calculateOffset&&(this.offset=this.calculateOffset(this.size)),OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,{x:this.px.x+this.offset.x,y:this.px.y+this.offset.y})))},display:function(a){this.imageDiv.style.display=a?"":"none"},isDrawn:function(){return this.imageDiv&&this.imageDiv.parentNode&&11!=this.imageDiv.parentNode.nodeType},CLASS_NAME:"OpenLayers.Icon"});OpenLayers.Marker=OpenLayers.Class({icon:null,lonlat:null,events:null,map:null,initialize:function(a,b){this.lonlat=a;var c=b?b:OpenLayers.Marker.defaultIcon();null==this.icon?this.icon=c:(this.icon.url=c.url,this.icon.size=c.size,this.icon.offset=c.offset,this.icon.calculateOffset=c.calculateOffset);this.events=new OpenLayers.Events(this,this.icon.imageDiv)},destroy:function(){this.erase();this.map=null;this.events.destroy();this.events=null;null!=this.icon&&(this.icon.destroy(),this.icon=null)},draw:function(a){return this.icon.draw(a)},erase:function(){null!=this.icon&&this.icon.erase()},moveTo:function(a){null!=a&&null!=this.icon&&this.icon.moveTo(a);this.lonlat=this.map.getLonLatFromLayerPx(a)},isDrawn:function(){return this.icon&&this.icon.isDrawn()},onScreen:function(){var a=!1;this.map&&(a=this.map.getExtent().containsLonLat(this.lonlat));return a},inflate:function(a){this.icon&&this.icon.setSize({w:this.icon.size.w*a,h:this.icon.size.h*a})},setOpacity:function(a){this.icon.setOpacity(a)},setUrl:function(a){this.icon.setUrl(a)},display:function(a){this.icon.display(a)},CLASS_NAME:"OpenLayers.Marker"});OpenLayers.Marker.defaultIcon=function(){return new OpenLayers.Icon(OpenLayers.Util.getImageLocation("marker.png"),{w:21,h:25},{x:-10.5,y:-25})};OpenLayers.Layer.TileCache=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:!0,format:"image/png",serverResolutions:null,initialize:function(a,b,c,d){this.layername=c;OpenLayers.Layer.Grid.prototype.initialize.apply(this,[a,b,{},d]);this.extension=this.format.split("/")[1].toLowerCase();this.extension="jpg"==this.extension?"jpeg":this.extension},clone:function(a){null==a&&(a=new OpenLayers.Layer.TileCache(this.name,this.url,this.layername,this.getOptions()));return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a])},getURL:function(a){function b(a,b){for(var a=""+a,c=[],d=0;d<b;++d)c.push("0");return c.join("").substring(0,b-a.length)+a}var c=this.getServerResolution(),d=this.maxExtent,e=this.tileSize,f=Math.round((a.left-d.left)/(c*e.w)),a=Math.round((a.bottom-d.bottom)/(c*e.h)),c=null!=this.serverResolutions?OpenLayers.Util.indexOf(this.serverResolutions,c):this.map.getZoom(),f=[this.layername,b(c,2),b(parseInt(f/1e6),3),b(parseInt(f/1e3)%1e3,3),b(parseInt(f)%1e3,3),b(parseInt(a/1e6),3),b(parseInt(a/1e3)%1e3,3),b(parseInt(a)%1e3,3)+"."+this.extension].join("/"),c=this.url;OpenLayers.Util.isArray(c)&&(c=this.selectUrl(f,c));c="/"==c.charAt(c.length-1)?c:c+"/";return c+f},CLASS_NAME:"OpenLayers.Layer.TileCache"});OpenLayers.Layer.KaMap=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:!0,DEFAULT_PARAMS:{i:"jpeg",map:""},initialize:function(a,b,c,d){OpenLayers.Layer.Grid.prototype.initialize.apply(this,arguments);this.params=OpenLayers.Util.applyDefaults(this.params,this.DEFAULT_PARAMS)},getURL:function(a){var a=this.adjustBounds(a),b=this.map.getResolution(),c=Math.round(1e4*this.map.getScale())/1e4,d=Math.round(a.left/b);return this.getFullRequestString({t:-Math.round(a.top/b),l:d,s:c})},calculateGridLayout:function(a,b,c){var b=c*this.tileSize.w,c=c*this.tileSize.h,d=a.left,e=Math.floor(d/b)-this.buffer,d=-(d/b-e)*this.tileSize.w,e=e*b,a=a.top,f=Math.ceil(a/c)+this.buffer;return{tilelon:b,tilelat:c,tileoffsetlon:e,tileoffsetlat:f*c,tileoffsetx:d,tileoffsety:-(f-a/c+1)*this.tileSize.h}},clone:function(a){null==a&&(a=new OpenLayers.Layer.KaMap(this.name,this.url,this.params,this.getOptions()));a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);null!=this.tileSize&&(a.tileSize=this.tileSize.clone());a.grid=[];return a},getTileBounds:function(a){var b=this.getResolution(),c=b*this.tileSize.w,b=b*this.tileSize.h,d=this.getLonLatFromViewPortPx(a),a=c*Math.floor(d.lon/c),d=b*Math.floor(d.lat/b);return new OpenLayers.Bounds(a,d,a+c,d+b)},CLASS_NAME:"OpenLayers.Layer.KaMap"});OpenLayers.Control.TransformFeature=OpenLayers.Class(OpenLayers.Control,{geometryTypes:null,layer:null,preserveAspectRatio:!1,rotate:!0,feature:null,renderIntent:"temporary",rotationHandleSymbolizer:null,box:null,center:null,scale:1,ratio:1,rotation:0,handles:null,rotationHandles:null,dragControl:null,irregular:!1,initialize:function(a,b){OpenLayers.Control.prototype.initialize.apply(this,[b]);this.layer=a;this.rotationHandleSymbolizer||(this.rotationHandleSymbolizer={stroke:!1,pointRadius:10,fillOpacity:0,cursor:"pointer"});this.createBox();this.createControl()},activate:function(){var a=!1;OpenLayers.Control.prototype.activate.apply(this,arguments)&&(this.dragControl.activate(),this.layer.addFeatures([this.box]),this.rotate&&this.layer.addFeatures(this.rotationHandles),this.layer.addFeatures(this.handles),a=!0);return a},deactivate:function(){var a=!1;OpenLayers.Control.prototype.deactivate.apply(this,arguments)&&(this.layer.removeFeatures(this.handles),this.rotate&&this.layer.removeFeatures(this.rotationHandles),this.layer.removeFeatures([this.box]),this.dragControl.deactivate(),a=!0);return a},setMap:function(a){this.dragControl.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,arguments)},setFeature:function(a,b){var b=OpenLayers.Util.applyDefaults(b,{rotation:0,scale:1,ratio:1}),c=this.rotation,d=this.center;OpenLayers.Util.extend(this,b);if(!1!==this.events.triggerEvent("beforesetfeature",{feature:a})){this.feature=a;this.activate();this._setfeature=!0;var e=this.feature.geometry.getBounds();this.box.move(e.getCenterLonLat());this.box.geometry.rotate(-c,d);this._angle=0;this.rotation?(c=a.geometry.clone(),c.rotate(-this.rotation,this.center),c=new OpenLayers.Feature.Vector(c.getBounds().toGeometry()),c.geometry.rotate(this.rotation,this.center),this.box.geometry.rotate(this.rotation,this.center),this.box.move(c.geometry.getBounds().getCenterLonLat()),c=c.geometry.components[0].components[0].getBounds().getCenterLonLat()):c=new OpenLayers.LonLat(e.left,e.bottom);this.handles[0].move(c);delete this._setfeature;this.events.triggerEvent("setfeature",{feature:a})}},unsetFeature:function(){this.active?this.deactivate():(this.feature=null,this.rotation=0,this.ratio=this.scale=1)},createBox:function(){var a=this;this.center=new OpenLayers.Geometry.Point(0,0);this.box=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString([new OpenLayers.Geometry.Point(-1,-1),new OpenLayers.Geometry.Point(0,-1),new OpenLayers.Geometry.Point(1,-1),new OpenLayers.Geometry.Point(1,0),new OpenLayers.Geometry.Point(1,1),new OpenLayers.Geometry.Point(0,1),new OpenLayers.Geometry.Point(-1,1),new OpenLayers.Geometry.Point(-1,0),new OpenLayers.Geometry.Point(-1,-1)]),null,"string"==typeof this.renderIntent?null:this.renderIntent);this.box.geometry.move=function(b,c){a._moving=!0;OpenLayers.Geometry.LineString.prototype.move.apply(this,arguments);a.center.move(b,c);delete a._moving};for(var b=function(a,b){OpenLayers.Geometry.Point.prototype.move.apply(this,arguments);this._rotationHandle&&this._rotationHandle.geometry.move(a,b);this._handle.geometry.move(a,b)},c=function(a,b,c){OpenLayers.Geometry.Point.prototype.resize.apply(this,arguments);this._rotationHandle&&this._rotationHandle.geometry.resize(a,b,c);this._handle.geometry.resize(a,b,c)},d=function(a,b){OpenLayers.Geometry.Point.prototype.rotate.apply(this,arguments);this._rotationHandle&&this._rotationHandle.geometry.rotate(a,b);this._handle.geometry.rotate(a,b)},e=function(b,c){var d=this.x,e=this.y;OpenLayers.Geometry.Point.prototype.move.call(this,b,c);if(!a._moving){var f=a.dragControl.handlers.drag.evt,g=!(!a._setfeature&&a.preserveAspectRatio)&&!(f&&f.shiftKey),h=new OpenLayers.Geometry.Point(d,e),f=a.center;this.rotate(-a.rotation,f);h.rotate(-a.rotation,f);var i=this.x-f.x,j=this.y-f.y,k=i-(this.x-h.x),l=j-(this.y-h.y);a.irregular&&!a._setfeature&&(i-=(this.x-h.x)/2,j-=(this.y-h.y)/2);this.x=d;this.y=e;h=1;g?(j=1e-5>Math.abs(l)?1:j/l,h=(1e-5>Math.abs(k)?1:i/k)/j):(k=Math.sqrt(k*k+l*l),j=Math.sqrt(i*i+j*j)/k);a._moving=!0;a.box.geometry.rotate(-a.rotation,f);delete a._moving;a.box.geometry.resize(j,f,h);a.box.geometry.rotate(a.rotation,f);a.transformFeature({scale:j,ratio:h});a.irregular&&!a._setfeature&&(i=f.clone(),i.x+=1e-5>Math.abs(d-f.x)?0:this.x-d,i.y+=1e-5>Math.abs(e-f.y)?0:this.y-e,a.box.geometry.move(this.x-d,this.y-e),a.transformFeature({center:i}))}},f=function(b,c){var d=this.x,e=this.y;OpenLayers.Geometry.Point.prototype.move.call(this,b,c);if(!a._moving){var f=a.dragControl.handlers.drag.evt,f=f&&f.shiftKey?45:1,g=a.center,h=this.x-g.x,i=this.y-g.y;this.x=d;this.y=e;d=Math.atan2(i-c,h-b);d=Math.atan2(i,h)-d;d*=180/Math.PI;a._angle=(a._angle+d)%360;d=a.rotation%f;if(Math.abs(a._angle)>=f||0!==d)d=Math.round(a._angle/f)*f-d,a._angle=0,a.box.geometry.rotate(d,g),a.transformFeature({rotation:d})}},g=Array(8),h=Array(4),i,j,k,l="sw s se e ne n nw w".split(" "),m=0;8>m;++m)i=this.box.geometry.components[m],j=new OpenLayers.Feature.Vector(i.clone(),{role:l[m]+"-resize"},"string"==typeof this.renderIntent?null:this.renderIntent),0==m%2&&(k=new OpenLayers.Feature.Vector(i.clone(),{role:l[m]+"-rotate"},"string"==typeof this.rotationHandleSymbolizer?null:this.rotationHandleSymbolizer),k.geometry.move=f,i._rotationHandle=k,h[m/2]=k),i.move=b,i.resize=c,i.rotate=d,j.geometry.move=e,i._handle=j,g[m]=j;this.rotationHandles=h;this.handles=g},createControl:function(){var a=this;this.dragControl=new OpenLayers.Control.DragFeature(this.layer,{documentDrag:!0,moveFeature:function(b){this.feature===a.feature&&(this.feature=a.box);OpenLayers.Control.DragFeature.prototype.moveFeature.apply(this,arguments)},onDrag:function(b){b===a.box&&a.transformFeature({center:a.center})},onStart:function(b){var c=!a.geometryTypes||-1!==OpenLayers.Util.indexOf(a.geometryTypes,b.geometry.CLASS_NAME),d=OpenLayers.Util.indexOf(a.handles,b),d=d+OpenLayers.Util.indexOf(a.rotationHandles,b);b!==a.feature&&(b!==a.box&&-2==d&&c)&&a.setFeature(b)},onComplete:function(){a.events.triggerEvent("transformcomplete",{feature:a.feature})}})},drawHandles:function(){for(var a=this.layer,b=0;8>b;++b)this.rotate&&0===b%2&&a.drawFeature(this.rotationHandles[b/2],this.rotationHandleSymbolizer),a.drawFeature(this.handles[b],this.renderIntent)},transformFeature:function(a){if(!this._setfeature){this.scale*=a.scale||1;this.ratio*=a.ratio||1;var b=this.rotation;this.rotation=(this.rotation+(a.rotation||0))%360;if(!1!==this.events.triggerEvent("beforetransform",a)){var c=this.feature,d=c.geometry,e=this.center;d.rotate(-b,e);a.scale||a.ratio?d.resize(a.scale,e,a.ratio):a.center&&c.move(a.center.getBounds().getCenterLonLat());d.rotate(this.rotation,e);this.layer.drawFeature(c);c.toState(OpenLayers.State.UPDATE);this.events.triggerEvent("transform",a)}}this.layer.drawFeature(this.box,this.renderIntent);this.drawHandles()},destroy:function(){for(var a,b=0;8>b;++b)a=this.box.geometry.components[b],a._handle.destroy(),a._handle=null,a._rotationHandle&&a._rotationHandle.destroy(),a._rotationHandle=null;this.rotationHandles=this.rotationHandleSymbolizer=this.handles=this.feature=this.center=null;this.box.destroy();this.layer=this.box=null;this.dragControl.destroy();this.dragControl=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},CLASS_NAME:"OpenLayers.Control.TransformFeature"});OpenLayers.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:"olHandlerBoxZoomBox",boxOffsets:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.dragHandler=new OpenLayers.Handler.Drag(this,{down:this.startBox,move:this.moveBox,out:this.removeBox,up:this.endBox},{keyMask:this.keyMask})},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);this.dragHandler&&(this.dragHandler.destroy(),this.dragHandler=null)},setMap:function(a){OpenLayers.Handler.prototype.setMap.apply(this,arguments);this.dragHandler&&this.dragHandler.setMap(a)},startBox:function(){this.callback("start",[]);this.zoomBox=OpenLayers.Util.createDiv("zoomBox",{x:-9999,y:-9999});this.zoomBox.className=this.boxDivClassName;this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.viewPortDiv.appendChild(this.zoomBox);OpenLayers.Element.addClass(this.map.viewPortDiv,"olDrawBox")},moveBox:function(a){var b=this.dragHandler.start.x,c=this.dragHandler.start.y,d=Math.abs(b-a.x),e=Math.abs(c-a.y),f=this.getBoxOffsets();this.zoomBox.style.width=d+f.width+1+"px";this.zoomBox.style.height=e+f.height+1+"px";this.zoomBox.style.left=(a.x<b?b-d-f.left:b-f.left)+"px";this.zoomBox.style.top=(a.y<c?c-e-f.top:c-f.top)+"px"},endBox:function(a){var b;if(5<Math.abs(this.dragHandler.start.x-a.x)||5<Math.abs(this.dragHandler.start.y-a.y)){var c=this.dragHandler.start;b=Math.min(c.y,a.y);var d=Math.max(c.y,a.y),e=Math.min(c.x,a.x),a=Math.max(c.x,a.x);b=new OpenLayers.Bounds(e,d,a,b)}else b=this.dragHandler.start.clone();this.removeBox();this.callback("done",[b])},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.boxOffsets=this.zoomBox=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDrawBox")},activate:function(){return OpenLayers.Handler.prototype.activate.apply(this,arguments)?(this.dragHandler.activate(),!0):!1},deactivate:function(){return OpenLayers.Handler.prototype.deactivate.apply(this,arguments)?(this.dragHandler.deactivate()&&this.zoomBox&&this.removeBox(),!0):!1},getBoxOffsets:function(){if(!this.boxOffsets){var a=document.createElement("div");a.style.position="absolute";a.style.border="1px solid black";a.style.width="3px";document.body.appendChild(a);var b=3==a.clientWidth;document.body.removeChild(a);var a=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width")),c=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width")),d=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-top-width")),e=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"));this.boxOffsets={left:a,right:c,top:d,bottom:e,width:!1===b?a+c:0,height:!1===b?d+e:0}}return this.boxOffsets},CLASS_NAME:"OpenLayers.Handler.Box"});OpenLayers.Control.ZoomBox=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,out:!1,keyMask:null,alwaysZoom:!1,draw:function(){this.handler=new OpenLayers.Handler.Box(this,{done:this.zoomBox},{keyMask:this.keyMask})},zoomBox:function(a){if(a instanceof OpenLayers.Bounds){var b;if(this.out){b=Math.abs(a.right-a.left);var c=Math.abs(a.top-a.bottom);b=Math.min(this.map.size.h/c,this.map.size.w/b);var c=this.map.getExtent(),d=this.map.getLonLatFromPixel(a.getCenterPixel()),a=d.lon-c.getWidth()/2*b,e=d.lon+c.getWidth()/2*b,f=d.lat-c.getHeight()/2*b;b=d.lat+c.getHeight()/2*b;b=new OpenLayers.Bounds(a,f,e,b)}else b=this.map.getLonLatFromPixel({x:a.left,y:a.bottom}),c=this.map.getLonLatFromPixel({x:a.right,y:a.top}),b=new OpenLayers.Bounds(b.lon,b.lat,c.lon,c.lat);c=this.map.getZoom();this.map.zoomToExtent(b);c==this.map.getZoom()&&!0==this.alwaysZoom&&this.map.zoomTo(c+(this.out?-1:1))}else this.out?this.map.setCenter(this.map.getLonLatFromPixel(a),this.map.getZoom()-1):this.map.setCenter(this.map.getLonLatFromPixel(a),this.map.getZoom()+1)},CLASS_NAME:"OpenLayers.Control.ZoomBox"});OpenLayers.Control.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:!1,interval:1,documentDrag:!1,kinetic:null,enableKinetic:!1,kineticInterval:10,draw:function(){if(this.enableKinetic){var a={interval:this.kineticInterval};"object"===typeof this.enableKinetic&&(a=OpenLayers.Util.extend(a,this.enableKinetic));this.kinetic=new OpenLayers.Kinetic(a)}this.handler=new OpenLayers.Handler.Drag(this,{move:this.panMap,done:this.panMapDone,down:this.panMapStart},{interval:this.interval,documentDrag:this.documentDrag})},panMapStart:function(){this.kinetic&&this.kinetic.begin()},panMap:function(a){this.kinetic&&this.kinetic.update(a);this.panned=!0;this.map.pan(this.handler.last.x-a.x,this.handler.last.y-a.y,{dragging:!0,animate:!1})},panMapDone:function(a){if(this.panned){var b=null;this.kinetic&&(b=this.kinetic.end(a));this.map.pan(this.handler.last.x-a.x,this.handler.last.y-a.y,{dragging:!!b,animate:!1});if(b){var c=this;this.kinetic.move(b,function(a,b,f){c.map.pan(a,b,{dragging:!f,animate:!1})})}this.panned=!1}},CLASS_NAME:"OpenLayers.Control.DragPan"});OpenLayers.Handler.Click=OpenLayers.Class(OpenLayers.Handler,{delay:300,single:!0,"double":!1,pixelTolerance:0,dblclickTolerance:13,stopSingle:!1,stopDouble:!1,timerId:null,touch:!1,down:null,last:null,first:null,rightclickTimerId:null,touchstart:function(a){this.touch||(this.unregisterMouseListeners(),this.touch=!0);this.down=this.getEventInfo(a);this.last=this.getEventInfo(a);return!0},touchmove:function(a){this.last=this.getEventInfo(a);return!0},touchend:function(a){this.down&&(a.xy=this.last.xy,a.lastTouches=this.last.touches,this.handleSingle(a),this.down=null);return!0},unregisterMouseListeners:function(){this.map.events.un({mousedown:this.mousedown,mouseup:this.mouseup,click:this.click,dblclick:this.dblclick,scope:this})},mousedown:function(a){this.down=this.getEventInfo(a);this.last=this.getEventInfo(a);return!0},mouseup:function(a){var b=!0;this.checkModifiers(a)&&(this.control.handleRightClicks&&OpenLayers.Event.isRightClick(a))&&(b=this.rightclick(a));return b},rightclick:function(a){if(this.passesTolerance(a)){if(null!=this.rightclickTimerId)return this.clearTimer(),this.callback("dblrightclick",[a]),!this.stopDouble;a=this["double"]?OpenLayers.Util.extend({},a):this.callback("rightclick",[a]);a=OpenLayers.Function.bind(this.delayedRightCall,this,a);this.rightclickTimerId=window.setTimeout(a,this.delay)}return!this.stopSingle},delayedRightCall:function(a){this.rightclickTimerId=null;a&&this.callback("rightclick",[a])},click:function(a){this.last||(this.last=this.getEventInfo(a));this.handleSingle(a);return!this.stopSingle},dblclick:function(a){this.handleDouble(a);return!this.stopDouble},handleDouble:function(a){this.passesDblclickTolerance(a)&&(this["double"]&&this.callback("dblclick",[a]),this.clearTimer())},handleSingle:function(a){this.passesTolerance(a)&&(null!=this.timerId?(this.last.touches&&1===this.last.touches.length&&(this["double"]&&OpenLayers.Event.stop(a),this.handleDouble(a)),(!this.last.touches||2!==this.last.touches.length)&&this.clearTimer()):(this.first=this.getEventInfo(a),this.queuePotentialClick(this.single?OpenLayers.Util.extend({},a):null)))},queuePotentialClick:function(a){this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,a),this.delay)},passesTolerance:function(a){var b=!0;if(null!=this.pixelTolerance&&this.down&&this.down.xy&&(b=this.pixelTolerance>=this.down.xy.distanceTo(a.xy))&&this.touch&&this.down.touches.length===this.last.touches.length)for(var a=0,c=this.down.touches.length;a<c;++a)if(this.getTouchDistance(this.down.touches[a],this.last.touches[a])>this.pixelTolerance){b=!1;break}return b},getTouchDistance:function(a,b){return Math.sqrt(Math.pow(a.clientX-b.clientX,2)+Math.pow(a.clientY-b.clientY,2))},passesDblclickTolerance:function(){var a=!0;this.down&&this.first&&(a=this.down.xy.distanceTo(this.first.xy)<=this.dblclickTolerance);return a},clearTimer:function(){null!=this.timerId&&(window.clearTimeout(this.timerId),this.timerId=null);null!=this.rightclickTimerId&&(window.clearTimeout(this.rightclickTimerId),this.rightclickTimerId=null)},delayedCall:function(a){this.timerId=null;a&&this.callback("click",[a])},getEventInfo:function(a){var b;if(a.touches){var c=a.touches.length;b=Array(c);for(var d,e=0;e<c;e++)d=a.touches[e],b[e]={clientX:d.clientX,clientY:d.clientY}}return{xy:a.xy,touches:b}},deactivate:function(){var a=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.clearTimer(),this.last=this.first=this.down=null,this.touch=!1,a=!0);return a},CLASS_NAME:"OpenLayers.Handler.Click"});OpenLayers.Control.Navigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,pinchZoom:null,pinchZoomOptions:null,documentDrag:!1,zoomBox:null,zoomBoxEnabled:!0,zoomWheelEnabled:!0,mouseWheelOptions:null,handleRightClicks:!1,zoomBoxKeyMask:OpenLayers.Handler.MOD_SHIFT,autoActivate:!0,
initialize:function(a){this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.deactivate();this.dragPan&&this.dragPan.destroy();this.dragPan=null;this.zoomBox&&this.zoomBox.destroy();this.zoomBox=null;this.pinchZoom&&this.pinchZoom.destroy();this.pinchZoom=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},activate:function(){this.dragPan.activate();this.zoomWheelEnabled&&this.handlers.wheel.activate();this.handlers.click.activate();this.zoomBoxEnabled&&this.zoomBox.activate();this.pinchZoom&&this.pinchZoom.activate();return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){this.pinchZoom&&this.pinchZoom.deactivate();this.zoomBox.deactivate();this.dragPan.deactivate();this.handlers.click.deactivate();this.handlers.wheel.deactivate();return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},draw:function(){this.handleRightClicks&&(this.map.viewPortDiv.oncontextmenu=OpenLayers.Function.False);this.handlers.click=new OpenLayers.Handler.Click(this,{click:this.defaultClick,dblclick:this.defaultDblClick,dblrightclick:this.defaultDblRightClick},{"double":!0,stopDouble:!0});this.dragPan=new OpenLayers.Control.DragPan(OpenLayers.Util.extend({map:this.map,documentDrag:this.documentDrag},this.dragPanOptions));this.zoomBox=new OpenLayers.Control.ZoomBox({map:this.map,keyMask:this.zoomBoxKeyMask});this.dragPan.draw();this.zoomBox.draw();this.handlers.wheel=new OpenLayers.Handler.MouseWheel(this,{up:this.wheelUp,down:this.wheelDown},this.mouseWheelOptions);OpenLayers.Control.PinchZoom&&(this.pinchZoom=new OpenLayers.Control.PinchZoom(OpenLayers.Util.extend({map:this.map},this.pinchZoomOptions)))},defaultClick:function(a){a.lastTouches&&2==a.lastTouches.length&&this.map.zoomOut()},defaultDblClick:function(a){this.map.setCenter(this.map.getLonLatFromViewPortPx(a.xy),this.map.zoom+1)},defaultDblRightClick:function(a){this.map.setCenter(this.map.getLonLatFromViewPortPx(a.xy),this.map.zoom-1)},wheelChange:function(a,b){var c=this.map.getZoom(),d=this.map.getZoom()+Math.round(b),d=Math.max(d,0),d=Math.min(d,this.map.getNumZoomLevels());if(d!==c){var e=this.map.getSize(),c=e.w/2-a.xy.x,e=a.xy.y-e.h/2,f=this.map.baseLayer.getResolutionForZoom(d),g=this.map.getLonLatFromPixel(a.xy);this.map.setCenter(new OpenLayers.LonLat(g.lon+c*f,g.lat+e*f),d)}},wheelUp:function(a,b){this.wheelChange(a,b||1)},wheelDown:function(a,b){this.wheelChange(a,b||-1)},disableZoomBox:function(){this.zoomBoxEnabled=!1;this.zoomBox.deactivate()},enableZoomBox:function(){this.zoomBoxEnabled=!0;this.active&&this.zoomBox.activate()},disableZoomWheel:function(){this.zoomWheelEnabled=!1;this.handlers.wheel.deactivate()},enableZoomWheel:function(){this.zoomWheelEnabled=!0;this.active&&this.handlers.wheel.activate()},CLASS_NAME:"OpenLayers.Control.Navigation"});OpenLayers.Control.DrawFeature=OpenLayers.Class(OpenLayers.Control,{layer:null,callbacks:null,multi:!1,featureAdded:function(){},handlerOptions:null,initialize:function(a,b,c){OpenLayers.Control.prototype.initialize.apply(this,[c]);this.callbacks=OpenLayers.Util.extend({done:this.drawFeature,modify:function(a,b){this.layer.events.triggerEvent("sketchmodified",{vertex:a,feature:b})},create:function(a,b){this.layer.events.triggerEvent("sketchstarted",{vertex:a,feature:b})}},this.callbacks);this.layer=a;this.handlerOptions=this.handlerOptions||{};this.handlerOptions.layerOptions=OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions,{renderers:a.renderers,rendererOptions:a.rendererOptions});"multi"in this.handlerOptions||(this.handlerOptions.multi=this.multi);if(a=this.layer.styleMap&&this.layer.styleMap.styles.temporary)this.handlerOptions.layerOptions=OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions,{styleMap:new OpenLayers.StyleMap({"default":a})});this.handler=new b(this,this.callbacks,this.handlerOptions)},drawFeature:function(a){a=new OpenLayers.Feature.Vector(a);!1!==this.layer.events.triggerEvent("sketchcomplete",{feature:a})&&(a.state=OpenLayers.State.INSERT,this.layer.addFeatures([a]),this.featureAdded(a),this.events.triggerEvent("featureadded",{feature:a}))},insertXY:function(a,b){this.handler&&this.handler.line&&this.handler.insertXY(a,b)},insertDeltaXY:function(a,b){this.handler&&this.handler.line&&this.handler.insertDeltaXY(a,b)},insertDirectionLength:function(a,b){this.handler&&this.handler.line&&this.handler.insertDirectionLength(a,b)},insertDeflectionLength:function(a,b){this.handler&&this.handler.line&&this.handler.insertDeflectionLength(a,b)},undo:function(){return this.handler.undo&&this.handler.undo()},redo:function(){return this.handler.redo&&this.handler.redo()},finishSketch:function(){this.handler.finishGeometry()},cancel:function(){this.handler.cancel()},CLASS_NAME:"OpenLayers.Control.DrawFeature"});OpenLayers.Handler.Polygon=OpenLayers.Class(OpenLayers.Handler.Path,{holeModifier:null,drawingHole:!1,polygon:null,createFeature:function(a){a=this.layer.getLonLatFromViewPortPx(a);a=new OpenLayers.Geometry.Point(a.lon,a.lat);this.point=new OpenLayers.Feature.Vector(a);this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LinearRing([this.point.geometry]));this.polygon=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([this.line.geometry]));this.callback("create",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.layer.addFeatures([this.polygon,this.point],{silent:!0})},addPoint:function(a){if(!this.drawingHole&&this.holeModifier&&this.evt&&this.evt[this.holeModifier])for(var b=this.point.geometry,c=this.control.layer.features,d,e=c.length-1;0<=e;--e)if(d=c[e].geometry,(d instanceof OpenLayers.Geometry.Polygon||d instanceof OpenLayers.Geometry.MultiPolygon)&&d.intersects(b)){b=c[e];this.control.layer.removeFeatures([b],{silent:!0});this.control.layer.events.registerPriority("sketchcomplete",this,this.finalizeInteriorRing);this.control.layer.events.registerPriority("sketchmodified",this,this.enforceTopology);b.geometry.addComponent(this.line.geometry);this.polygon=b;this.drawingHole=!0;break}OpenLayers.Handler.Path.prototype.addPoint.apply(this,arguments)},getCurrentPointIndex:function(){return this.line.geometry.components.length-2},enforceTopology:function(a){var a=a.vertex,b=this.line.geometry.components;this.polygon.geometry.intersects(a)||(b=b[b.length-3],a.x=b.x,a.y=b.y)},finishGeometry:function(){this.line.geometry.removeComponent(this.line.geometry.components[this.line.geometry.components.length-2]);this.removePoint();this.finalize()},finalizeInteriorRing:function(){var a=this.line.geometry,b=0!==a.getArea();if(b){for(var c=this.polygon.geometry.components,d=c.length-2;0<=d;--d)if(a.intersects(c[d])){b=!1;break}if(b){d=c.length-2;a:for(;0<d;--d)for(var e=c[d].components,f=0,g=e.length;f<g;++f)if(a.containsPoint(e[f])){b=!1;break a}}}b?this.polygon.state!==OpenLayers.State.INSERT&&(this.polygon.state=OpenLayers.State.UPDATE):this.polygon.geometry.removeComponent(a);this.restoreFeature();return!1},cancel:function(){this.drawingHole&&(this.polygon.geometry.removeComponent(this.line.geometry),this.restoreFeature(!0));return OpenLayers.Handler.Path.prototype.cancel.apply(this,arguments)},restoreFeature:function(a){this.control.layer.events.unregister("sketchcomplete",this,this.finalizeInteriorRing);this.control.layer.events.unregister("sketchmodified",this,this.enforceTopology);this.layer.removeFeatures([this.polygon],{silent:!0});this.control.layer.addFeatures([this.polygon],{silent:!0});this.drawingHole=!1;a||this.control.layer.events.triggerEvent("sketchcomplete",{feature:this.polygon})},destroyFeature:function(a){OpenLayers.Handler.Path.prototype.destroyFeature.call(this,a);this.polygon=null},drawFeature:function(){this.layer.drawFeature(this.polygon,this.style);this.layer.drawFeature(this.point,this.style)},getSketch:function(){return this.polygon},getGeometry:function(){var a=this.polygon&&this.polygon.geometry;a&&this.multi&&(a=new OpenLayers.Geometry.MultiPolygon([a]));return a},CLASS_NAME:"OpenLayers.Handler.Polygon"});OpenLayers.Control.EditingToolbar=OpenLayers.Class(OpenLayers.Control.Panel,{citeCompliant:!1,initialize:function(a,b){OpenLayers.Control.Panel.prototype.initialize.apply(this,[b]);this.addControls([new OpenLayers.Control.Navigation]);this.addControls([new OpenLayers.Control.DrawFeature(a,OpenLayers.Handler.Point,{displayClass:"olControlDrawFeaturePoint",handlerOptions:{citeCompliant:this.citeCompliant}}),new OpenLayers.Control.DrawFeature(a,OpenLayers.Handler.Path,{displayClass:"olControlDrawFeaturePath",handlerOptions:{citeCompliant:this.citeCompliant}}),new OpenLayers.Control.DrawFeature(a,OpenLayers.Handler.Polygon,{displayClass:"olControlDrawFeaturePolygon",handlerOptions:{citeCompliant:this.citeCompliant}})])},draw:function(){var a=OpenLayers.Control.Panel.prototype.draw.apply(this,arguments);null===this.defaultControl&&(this.defaultControl=this.controls[0]);return a},CLASS_NAME:"OpenLayers.Control.EditingToolbar"});OpenLayers.Strategy.BBOX=OpenLayers.Class(OpenLayers.Strategy,{bounds:null,resolution:null,ratio:2,resFactor:null,response:null,activate:function(){var a=OpenLayers.Strategy.prototype.activate.call(this);a&&(this.layer.events.on({moveend:this.update,refresh:this.update,visibilitychanged:this.update,scope:this}),this.update());return a},deactivate:function(){var a=OpenLayers.Strategy.prototype.deactivate.call(this);a&&this.layer.events.un({moveend:this.update,refresh:this.update,visibilitychanged:this.update,scope:this});return a},update:function(a){var b=this.getMapBounds();if(null!==b&&(a&&a.force||this.layer.visibility&&this.layer.calculateInRange()&&this.invalidBounds(b)))this.calculateBounds(b),this.resolution=this.layer.map.getResolution(),this.triggerRead(a)},getMapBounds:function(){if(null===this.layer.map)return null;var a=this.layer.map.getExtent();a&&!this.layer.projection.equals(this.layer.map.getProjectionObject())&&(a=a.clone().transform(this.layer.map.getProjectionObject(),this.layer.projection));return a},invalidBounds:function(a){a||(a=this.getMapBounds());a=!this.bounds||!this.bounds.containsBounds(a);!a&&this.resFactor&&(a=this.resolution/this.layer.map.getResolution(),a=a>=this.resFactor||a<=1/this.resFactor);return a},calculateBounds:function(a){a||(a=this.getMapBounds());var b=a.getCenterLonLat(),c=a.getWidth()*this.ratio,a=a.getHeight()*this.ratio;this.bounds=new OpenLayers.Bounds(b.lon-c/2,b.lat-a/2,b.lon+c/2,b.lat+a/2)},triggerRead:function(a){this.response&&!(a&&!0===a.noAbort)&&(this.layer.protocol.abort(this.response),this.layer.events.triggerEvent("loadend"));this.layer.events.triggerEvent("loadstart");this.response=this.layer.protocol.read(OpenLayers.Util.applyDefaults({filter:this.createFilter(),callback:this.merge,scope:this},a))},createFilter:function(){var a=new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.BBOX,value:this.bounds,projection:this.layer.projection});this.layer.filter&&(a=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND,filters:[this.layer.filter,a]}));return a},merge:function(a){this.layer.destroyFeatures();if((a=a.features)&&0<a.length){var b=this.layer.projection,c=this.layer.map.getProjectionObject();if(!c.equals(b))for(var d,e=0,f=a.length;e<f;++e)(d=a[e].geometry)&&d.transform(b,c);this.layer.addFeatures(a)}this.response=null;this.layer.events.triggerEvent("loadend")},CLASS_NAME:"OpenLayers.Strategy.BBOX"});OpenLayers.Layer.WorldWind=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{},isBaseLayer:!0,lzd:null,zoomLevels:null,initialize:function(a,b,c,d,e,f){this.lzd=c;this.zoomLevels=d;c=[];c.push(a,b,e,f);OpenLayers.Layer.Grid.prototype.initialize.apply(this,c);this.params=OpenLayers.Util.applyDefaults(this.params,this.DEFAULT_PARAMS)},getZoom:function(){var a=this.map.getZoom();this.map.getMaxExtent();return a-=Math.log(this.maxResolution/(this.lzd/512))/Math.log(2)},getURL:function(a){var a=this.adjustBounds(a),b=this.getZoom(),c=this.map.getMaxExtent(),d=this.lzd/Math.pow(2,this.getZoom()),e=Math.floor((a.left-c.left)/d),a=Math.floor((a.bottom-c.bottom)/d);return this.map.getResolution()<=this.lzd/512&&this.getZoom()<=this.zoomLevels?this.getFullRequestString({L:b,X:e,Y:a}):OpenLayers.Util.getImageLocation("blank.gif")},CLASS_NAME:"OpenLayers.Layer.WorldWind"});OpenLayers.Protocol.CSW=function(a){var a=OpenLayers.Util.applyDefaults(a,OpenLayers.Protocol.CSW.DEFAULTS),b=OpenLayers.Protocol.CSW["v"+a.version.replace(/\./g,"_")];if(!b)throw"Unsupported CSW version: "+a.version;return new b(a)};OpenLayers.Protocol.CSW.DEFAULTS={version:"2.0.2"};OpenLayers.Format.WMTSCapabilities=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{defaultVersion:"1.0.0",yx:{"urn:ogc:def:crs:EPSG::4326":!0},createLayer:function(a,b){var c,d={layer:!0,matrixSet:!0},e;for(e in d)if(!(e in b))throw Error("Missing property '"+e+"' in layer configuration.");d=a.contents;e=d.tileMatrixSets[b.matrixSet];for(var f,g=0,h=d.layers.length;g<h;++g)if(d.layers[g].identifier===b.layer){f=d.layers[g];break}if(f&&e){for(var i,g=0,h=f.styles.length;g<h&&!(i=f.styles[g],i.isDefault);++g);c=new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults(b,{url:"REST"===b.requestEncoding&&f.resourceUrl?f.resourceUrl.tile.template:a.operationsMetadata.GetTile.dcp.http.get[0].url,name:f.title,style:i.identifier,matrixIds:e.matrixIds,tileFullExtent:e.bounds}))}return c},CLASS_NAME:"OpenLayers.Format.WMTSCapabilities"});OpenLayers.Layer.Google.v3={DEFAULTS:{sphericalMercator:!0,projection:"EPSG:900913"},animationEnabled:!0,loadMapObject:function(){this.type||(this.type=google.maps.MapTypeId.ROADMAP);var a,b=OpenLayers.Layer.Google.cache[this.map.id];b?(a=b.mapObject,++b.count):(b=this.map.viewPortDiv,a=document.createElement("div"),a.id=this.map.id+"_GMapContainer",a.style.position="absolute",a.style.width="100%",a.style.height="100%",b.appendChild(a),b=this.map.getCenter(),a=new google.maps.Map(a,{center:b?new google.maps.LatLng(b.lat,b.lon):new google.maps.LatLng(0,0),zoom:this.map.getZoom()||0,mapTypeId:this.type,disableDefaultUI:!0,keyboardShortcuts:!1,draggable:!1,disableDoubleClickZoom:!0,scrollwheel:!1,streetViewControl:!1}),b={mapObject:a,count:1},OpenLayers.Layer.Google.cache[this.map.id]=b,this.repositionListener=google.maps.event.addListenerOnce(a,"center_changed",OpenLayers.Function.bind(this.repositionMapElements,this)));this.mapObject=a;this.setGMapVisibility(this.visibility)},repositionMapElements:function(){google.maps.event.trigger(this.mapObject,"resize");var a=this.mapObject.getDiv().firstChild;if(!a||3>a.childNodes.length)return this.repositionTimer=window.setTimeout(OpenLayers.Function.bind(this.repositionMapElements,this),250),!1;for(var b=OpenLayers.Layer.Google.cache[this.map.id],c=this.map.viewPortDiv,d=a.children.length-1;0<=d;--d){if(1000001==a.children[d].style.zIndex){var e=a.children[d];c.appendChild(e);e.style.zIndex="1100";e.style.bottom="";e.className="olLayerGoogleCopyright olLayerGoogleV3";e.style.display="";b.termsOfUse=e}1e6==a.children[d].style.zIndex&&(e=a.children[d],c.appendChild(e),e.style.zIndex="1100",e.style.bottom="",e.className="olLayerGooglePoweredBy olLayerGoogleV3 gmnoprint",e.style.display="",b.poweredBy=e);10000002==a.children[d].style.zIndex&&c.appendChild(a.children[d])}this.setGMapVisibility(this.visibility)},onMapResize:function(){if(this.visibility)google.maps.event.trigger(this.mapObject,"resize");else{var a=OpenLayers.Layer.Google.cache[this.map.id];if(!a.resized){var b=this;google.maps.event.addListenerOnce(this.mapObject,"tilesloaded",function(){google.maps.event.trigger(b.mapObject,"resize");b.moveTo(b.map.getCenter(),b.map.getZoom());delete a.resized})}a.resized=!0}},setGMapVisibility:function(a){var b=OpenLayers.Layer.Google.cache[this.map.id];if(b){for(var c=this.type,d=this.map.layers,e,f=d.length-1;0<=f;--f)if(e=d[f],e instanceof OpenLayers.Layer.Google&&!0===e.visibility&&!0===e.inRange){c=e.type;a=!0;break}d=this.mapObject.getDiv();!0===a?(this.mapObject.setMapTypeId(c),d.style.left="",b.termsOfUse&&b.termsOfUse.style&&(b.termsOfUse.style.left="",b.termsOfUse.style.display="",b.poweredBy.style.display=""),b.displayed=this.id):(delete b.displayed,d.style.left="-9999px",b.termsOfUse&&b.termsOfUse.style&&(b.termsOfUse.style.display="none",b.termsOfUse.style.left="-9999px",b.poweredBy.style.display="none"))}},getMapContainer:function(){return this.mapObject.getDiv()},getMapObjectBoundsFromOLBounds:function(a){var b=null;null!=a&&(b=this.sphericalMercator?this.inverseMercator(a.bottom,a.left):new OpenLayers.LonLat(a.bottom,a.left),a=this.sphericalMercator?this.inverseMercator(a.top,a.right):new OpenLayers.LonLat(a.top,a.right),b=new google.maps.LatLngBounds(new google.maps.LatLng(b.lat,b.lon),new google.maps.LatLng(a.lat,a.lon)));return b},getMapObjectLonLatFromMapObjectPixel:function(a){var b=this.map.getSize(),c=this.getLongitudeFromMapObjectLonLat(this.mapObject.center),d=this.getLatitudeFromMapObjectLonLat(this.mapObject.center),e=this.map.getResolution(),a=new OpenLayers.LonLat(c+(a.x-b.w/2)*e,d-(a.y-b.h/2)*e);this.wrapDateLine&&(a=a.wrapDateLine(this.maxExtent));return this.getMapObjectLonLatFromLonLat(a.lon,a.lat)},getMapObjectPixelFromMapObjectLonLat:function(a){var b=this.getLongitudeFromMapObjectLonLat(a),a=this.getLatitudeFromMapObjectLonLat(a),c=this.map.getResolution(),d=this.map.getExtent();return this.getMapObjectPixelFromXY(1/c*(b-d.left),1/c*(d.top-a))},setMapObjectCenter:function(a,b){if(!1===this.animationEnabled&&b!=this.mapObject.zoom){var c=this.getMapContainer();google.maps.event.addListenerOnce(this.mapObject,"idle",function(){c.style.visibility=""});c.style.visibility="hidden"}this.mapObject.setOptions({center:a,zoom:b})},getMapObjectZoomFromMapObjectBounds:function(a){return this.mapObject.getBoundsZoomLevel(a)},getMapObjectLonLatFromLonLat:function(a,b){var c;this.sphericalMercator?(c=this.inverseMercator(a,b),c=new google.maps.LatLng(c.lat,c.lon)):c=new google.maps.LatLng(b,a);return c},getMapObjectPixelFromXY:function(a,b){return new google.maps.Point(a,b)},destroy:function(){this.repositionListener&&google.maps.event.removeListener(this.repositionListener);this.repositionTimer&&window.clearTimeout(this.repositionTimer);OpenLayers.Layer.Google.prototype.destroy.apply(this,arguments)}};OpenLayers.Format.WPSDescribeProcess=OpenLayers.Class(OpenLayers.Format.XML,{VERSION:"1.0.0",namespaces:{wps:"http://www.opengis.net/wps/1.0.0",ows:"http://www.opengis.net/ows/1.1",xsi:"http://www.w3.org/2001/XMLSchema-instance"},schemaLocation:"http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd",defaultPrefix:"wps",regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a&&9==a.nodeType&&(a=a.documentElement);var b={};this.readNode(a,b);return b},readers:{wps:{ProcessDescriptions:function(a,b){b.processDescriptions={};this.readChildNodes(a,b.processDescriptions)},ProcessDescription:function(a,b){var c={processVersion:this.getAttributeNS(a,this.namespaces.wps,"processVersion"),statusSupported:"true"===a.getAttribute("statusSupported"),storeSupported:"true"===a.getAttribute("storeSupported")};this.readChildNodes(a,c);b[c.identifier]=c},DataInputs:function(a,b){b.dataInputs=[];this.readChildNodes(a,b.dataInputs)},ProcessOutputs:function(a,b){b.processOutputs=[];this.readChildNodes(a,b.processOutputs)},Output:function(a,b){var c={};this.readChildNodes(a,c);b.push(c)},ComplexOutput:function(a,b){b.complexOutput={};this.readChildNodes(a,b.complexOutput)},Input:function(a,b){var c={maxOccurs:parseInt(a.getAttribute("maxOccurs")),minOccurs:parseInt(a.getAttribute("minOccurs"))};this.readChildNodes(a,c);b.push(c)},BoundingBoxData:function(a,b){b.boundingBoxData={};this.readChildNodes(a,b.boundingBoxData)},CRS:function(a,b){b.CRSs||(b.CRSs={});b.CRSs[this.getChildValue(a)]=!0},LiteralData:function(a,b){b.literalData={};this.readChildNodes(a,b.literalData)},ComplexData:function(a,b){b.complexData={};this.readChildNodes(a,b.complexData)},Default:function(a,b){b["default"]={};this.readChildNodes(a,b["default"])},Supported:function(a,b){b.supported={};this.readChildNodes(a,b.supported)},Format:function(a,b){var c={};this.readChildNodes(a,c);b.formats||(b.formats={});b.formats[c.mimeType]=!0},MimeType:function(a,b){b.mimeType=this.getChildValue(a)}},ows:OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers.ows},CLASS_NAME:"OpenLayers.Format.WPSDescribeProcess"});OpenLayers.Format.CSWGetRecords.v2_0_2=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{csw:"http://www.opengis.net/cat/csw/2.0.2",dc:"http://purl.org/dc/elements/1.1/",dct:"http://purl.org/dc/terms/",gmd:"http://www.isotc211.org/2005/gmd",geonet:"http://www.fao.org/geonetwork",ogc:"http://www.opengis.net/ogc",ows:"http://www.opengis.net/ows",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},defaultPrefix:"csw",version:"2.0.2",schemaLocation:"http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd",requestId:null,resultType:null,outputFormat:null,outputSchema:null,startPosition:null,maxRecords:null,DistributedSearch:null,ResponseHandler:null,Query:null,regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a&&9==a.nodeType&&(a=a.documentElement);var b={};this.readNode(a,b);return b},readers:{csw:{GetRecordsResponse:function(a,b){b.records=[];this.readChildNodes(a,b);var c=this.getAttributeNS(a,"","version");""!=c&&(b.version=c)},RequestId:function(a,b){b.RequestId=this.getChildValue(a)},SearchStatus:function(a,b){b.SearchStatus={};var c=this.getAttributeNS(a,"","timestamp");""!=c&&(b.SearchStatus.timestamp=c)},SearchResults:function(a,b){this.readChildNodes(a,b);for(var c=a.attributes,d={},e=0,f=c.length;e<f;++e)d[c[e].name]="numberOfRecordsMatched"==c[e].name||"numberOfRecordsReturned"==c[e].name||"nextRecord"==c[e].name?parseInt(c[e].nodeValue):c[e].nodeValue;b.SearchResults=d},SummaryRecord:function(a,b){var c={type:"SummaryRecord"};this.readChildNodes(a,c);b.records.push(c)},BriefRecord:function(a,b){var c={type:"BriefRecord"};this.readChildNodes(a,c);b.records.push(c)},DCMIRecord:function(a,b){var c={type:"DCMIRecord"};this.readChildNodes(a,c);b.records.push(c)},Record:function(a,b){var c={type:"Record"};this.readChildNodes(a,c);b.records.push(c)},"*":function(a,b){var c=a.localName||a.nodeName.split(":").pop();b[c]=this.getChildValue(a)}},geonet:{info:function(a,b){var c={};this.readChildNodes(a,c);b.gninfo=c}},dc:{"*":function(a,b){var c=a.localName||a.nodeName.split(":").pop();OpenLayers.Util.isArray(b[c])||(b[c]=[]);for(var d={},e=a.attributes,f=0,g=e.length;f<g;++f)d[e[f].name]=e[f].nodeValue;d.value=this.getChildValue(a);""!=d.value&&b[c].push(d)}},dct:{"*":function(a,b){var c=a.localName||a.nodeName.split(":").pop();OpenLayers.Util.isArray(b[c])||(b[c]=[]);b[c].push(this.getChildValue(a))}},ows:OpenLayers.Util.applyDefaults({BoundingBox:function(a,b){b.bounds&&(b.BoundingBox=[{crs:b.projection,value:[b.bounds.left,b.bounds.bottom,b.bounds.right,b.bounds.top]}],delete b.projection,delete b.bounds);OpenLayers.Format.OWSCommon.v1_0_0.prototype.readers.ows.BoundingBox.apply(this,arguments)}},OpenLayers.Format.OWSCommon.v1_0_0.prototype.readers.ows)},write:function(a){a=this.writeNode("csw:GetRecords",a);a.setAttribute("xmlns:gmd",this.namespaces.gmd);return OpenLayers.Format.XML.prototype.write.apply(this,[a])},writers:{csw:{GetRecords:function(a){a||(a={});var b=this.createElementNSPlus("csw:GetRecords",{attributes:{service:"CSW",version:this.version,requestId:a.requestId||this.requestId,resultType:a.resultType||this.resultType,outputFormat:a.outputFormat||this.outputFormat,outputSchema:a.outputSchema||this.outputSchema,startPosition:a.startPosition||this.startPosition,maxRecords:a.maxRecords||this.maxRecords}});if(a.DistributedSearch||this.DistributedSearch)this.writeNode("csw:DistributedSearch",a.DistributedSearch||this.DistributedSearch,b);var c=a.ResponseHandler||this.ResponseHandler;if(OpenLayers.Util.isArray(c)&&0<c.length)for(var d=0,e=c.length;d<e;d++)this.writeNode("csw:ResponseHandler",c[d],b);this.writeNode("Query",a.Query||this.Query,b);return b},DistributedSearch:function(a){return this.createElementNSPlus("csw:DistributedSearch",{attributes:{hopCount:a.hopCount}})},ResponseHandler:function(a){return this.createElementNSPlus("csw:ResponseHandler",{value:a.value})},Query:function(a){a||(a={});var b=this.createElementNSPlus("csw:Query",{attributes:{typeNames:a.typeNames||"csw:Record"}}),c=a.ElementName;if(OpenLayers.Util.isArray(c)&&0<c.length)for(var d=0,e=c.length;d<e;d++)this.writeNode("csw:ElementName",c[d],b);else this.writeNode("csw:ElementSetName",a.ElementSetName||{value:"summary"},b);a.Constraint&&this.writeNode("csw:Constraint",a.Constraint,b);a.SortBy&&this.writeNode("ogc:SortBy",a.SortBy,b);return b},ElementName:function(a){return this.createElementNSPlus("csw:ElementName",{value:a.value})},ElementSetName:function(a){return this.createElementNSPlus("csw:ElementSetName",{attributes:{typeNames:a.typeNames},value:a.value})},Constraint:function(a){var b=this.createElementNSPlus("csw:Constraint",{attributes:{version:a.version}});if(a.Filter){var c=new OpenLayers.Format.Filter({version:a.version});b.appendChild(c.write(a.Filter))}else a.CqlText&&(a=this.createElementNSPlus("CqlText",{value:a.CqlText.value}),b.appendChild(a));return b}},ogc:OpenLayers.Format.Filter.v1_1_0.prototype.writers.ogc},CLASS_NAME:"OpenLayers.Format.CSWGetRecords.v2_0_2"});OpenLayers.Marker.Box=OpenLayers.Class(OpenLayers.Marker,{bounds:null,div:null,initialize:function(a,b,c){this.bounds=a;this.div=OpenLayers.Util.createDiv();this.div.style.overflow="hidden";this.events=new OpenLayers.Events(this,this.div);this.setBorder(b,c)},destroy:function(){this.div=this.bounds=null;OpenLayers.Marker.prototype.destroy.apply(this,arguments)},setBorder:function(a,b){a||(a="red");b||(b=2);this.div.style.border=b+"px solid "+a},draw:function(a,b){OpenLayers.Util.modifyDOMElement(this.div,null,a,b);return this.div},onScreen:function(){var a=!1;this.map&&(a=this.map.getExtent().containsBounds(this.bounds,!0,!0));return a},display:function(a){this.div.style.display=a?"":"none"},CLASS_NAME:"OpenLayers.Marker.Box"});OpenLayers.Format.Text=OpenLayers.Class(OpenLayers.Format,{defaultStyle:null,extractStyles:!0,initialize:function(a){a=a||{};!1!==a.extractStyles&&(a.defaultStyle={externalGraphic:OpenLayers.Util.getImageLocation("marker.png"),graphicWidth:21,graphicHeight:25,graphicXOffset:-10.5,graphicYOffset:-12.5});OpenLayers.Format.prototype.initialize.apply(this,[a])},read:function(a){for(var a=a.split("\n"),b,c=[],d=0;d<a.length-1;d++){var e=a[d].replace(/^\s*/,"").replace(/\s*$/,"");if("#"!=e.charAt(0))if(b){for(var e=e.split(" "),f=new OpenLayers.Geometry.Point(0,0),g={},h=this.defaultStyle?OpenLayers.Util.applyDefaults({},this.defaultStyle):null,i=!1,j=0;j<e.length;j++)if(e[j])if("point"==b[j])i=e[j].split(","),f.y=parseFloat(i[0]),f.x=parseFloat(i[1]),i=!0;else if("lat"==b[j])f.y=parseFloat(e[j]),i=!0;else if("lon"==b[j])f.x=parseFloat(e[j]),i=!0;else if("title"==b[j])g.title=e[j];else if("image"==b[j]||"icon"==b[j]&&h)h.externalGraphic=e[j];else if("iconSize"==b[j]&&h){var k=e[j].split(",");h.graphicWidth=parseFloat(k[0]);h.graphicHeight=parseFloat(k[1])}else"iconOffset"==b[j]&&h?(k=e[j].split(","),h.graphicXOffset=parseFloat(k[0]),h.graphicYOffset=parseFloat(k[1])):"description"==b[j]?g.description=e[j]:"overflow"==b[j]?g.overflow=e[j]:g[b[j]]=e[j];i&&(this.internalProjection&&this.externalProjection&&f.transform(this.externalProjection,this.internalProjection),e=new OpenLayers.Feature.Vector(f,g,h),c.push(e))}else b=e.split(" ")}return c},CLASS_NAME:"OpenLayers.Format.Text"});OpenLayers.Layer.Text=OpenLayers.Class(OpenLayers.Layer.Markers,{location:null,features:null,formatOptions:null,selectedFeature:null,initialize:function(a,b){OpenLayers.Layer.Markers.prototype.initialize.apply(this,arguments);this.features=[]},destroy:function(){OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments);this.clearFeatures();this.features=null},loadText:function(){!this.loaded&&null!=this.location&&(this.events.triggerEvent("loadstart"),OpenLayers.Request.GET({url:this.location,success:this.parseData,failure:function(){this.events.triggerEvent("loadend")},scope:this}),this.loaded=!0)},moveTo:function(a,b,c){OpenLayers.Layer.Markers.prototype.moveTo.apply(this,arguments);this.visibility&&!this.loaded&&this.loadText()},parseData:function(a){var a=a.responseText,b={};OpenLayers.Util.extend(b,this.formatOptions);this.map&&!this.projection.equals(this.map.getProjectionObject())&&(b.externalProjection=this.projection,b.internalProjection=this.map.getProjectionObject());for(var a=new OpenLayers.Format.Text(b).read(a),b=0,c=a.length;b<c;b++){var d={},e=a[b],f,g,h;f=new OpenLayers.LonLat(e.geometry.x,e.geometry.y);e.style.graphicWidth&&e.style.graphicHeight&&(g=new OpenLayers.Size(e.style.graphicWidth,e.style.graphicHeight));void 0!==e.style.graphicXOffset&&void 0!==e.style.graphicYOffset&&(h=new OpenLayers.Pixel(e.style.graphicXOffset,e.style.graphicYOffset));null!=e.style.externalGraphic?d.icon=new OpenLayers.Icon(e.style.externalGraphic,g,h):(d.icon=OpenLayers.Marker.defaultIcon(),null!=g&&d.icon.setSize(g));null!=e.attributes.title&&null!=e.attributes.description&&(d.popupContentHTML="<h2>"+e.attributes.title+"</h2><p>"+e.attributes.description+"</p>");d.overflow=e.attributes.overflow||"auto";d=new OpenLayers.Feature(this,f,d);this.features.push(d);f=d.createMarker();null!=e.attributes.title&&null!=e.attributes.description&&f.events.register("click",d,this.markerClick);this.addMarker(f)}this.events.triggerEvent("loadend")},markerClick:function(a){var b=this==this.layer.selectedFeature;this.layer.selectedFeature=!b?this:null;for(var c=0,d=this.layer.map.popups.length;c<d;c++)this.layer.map.removePopup(this.layer.map.popups[c]);b||this.layer.map.addPopup(this.createPopup());OpenLayers.Event.stop(a)},clearFeatures:function(){if(null!=this.features)for(;0<this.features.length;){var a=this.features[0];OpenLayers.Util.removeItem(this.features,a);a.destroy()}},CLASS_NAME:"OpenLayers.Layer.Text"});OpenLayers.Handler.RegularPolygon=OpenLayers.Class(OpenLayers.Handler.Drag,{sides:4,radius:null,snapAngle:null,snapToggle:"shiftKey",layerOptions:null,persist:!1,irregular:!1,citeCompliant:!1,angle:null,fixedRadius:!1,feature:null,layer:null,origin:null,initialize:function(a,b,c){if(!c||!c.layerOptions||!c.layerOptions.styleMap)this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style["default"],{});OpenLayers.Handler.Drag.prototype.initialize.apply(this,[a,b,c]);this.options=c?c:{}},setOptions:function(a){OpenLayers.Util.extend(this.options,a);OpenLayers.Util.extend(this,a)},activate:function(){var a=!1;OpenLayers.Handler.Drag.prototype.activate.apply(this,arguments)&&(a=OpenLayers.Util.extend({displayInLayerSwitcher:!1,calculateInRange:OpenLayers.Function.True,wrapDateLine:this.citeCompliant},this.layerOptions),this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,a),this.map.addLayer(this.layer),a=!0);return a},deactivate:function(){var a=!1;OpenLayers.Handler.Drag.prototype.deactivate.apply(this,arguments)&&(this.dragging&&this.cancel(),null!=this.layer.map&&(this.layer.destroy(!1),this.feature&&this.feature.destroy()),this.feature=this.layer=null,a=!0);return a},down:function(a){this.fixedRadius=!!this.radius;a=this.layer.getLonLatFromViewPortPx(a.xy);this.origin=new OpenLayers.Geometry.Point(a.lon,a.lat);if(!this.fixedRadius||this.irregular)this.radius=this.map.getResolution();this.persist&&this.clear();this.feature=new OpenLayers.Feature.Vector;this.createGeometry();this.callback("create",[this.origin,this.feature]);
this.layer.addFeatures([this.feature],{silent:!0});this.layer.drawFeature(this.feature,this.style)},move:function(a){var b=this.layer.getLonLatFromViewPortPx(a.xy),b=new OpenLayers.Geometry.Point(b.lon,b.lat);this.irregular?(a=Math.sqrt(2)*Math.abs(b.y-this.origin.y)/2,this.radius=Math.max(this.map.getResolution()/2,a)):this.fixedRadius?this.origin=b:(this.calculateAngle(b,a),this.radius=Math.max(this.map.getResolution()/2,b.distanceTo(this.origin)));this.modifyGeometry();this.irregular&&(a=b.x-this.origin.x,b=b.y-this.origin.y,this.feature.geometry.resize(1,this.origin,0==b?a/(this.radius*Math.sqrt(2)):a/b),this.feature.geometry.move(a/2,b/2));this.layer.drawFeature(this.feature,this.style)},up:function(a){this.finalize();this.start==this.last&&this.callback("done",[a.xy])},out:function(){this.finalize()},createGeometry:function(){this.angle=Math.PI*(1/this.sides-.5);this.snapAngle&&(this.angle+=this.snapAngle*(Math.PI/180));this.feature.geometry=OpenLayers.Geometry.Polygon.createRegularPolygon(this.origin,this.radius,this.sides,this.snapAngle)},modifyGeometry:function(){var a,b,c=this.feature.geometry.components[0];c.components.length!=this.sides+1&&(this.createGeometry(),c=this.feature.geometry.components[0]);for(var d=0;d<this.sides;++d)b=c.components[d],a=this.angle+2*d*Math.PI/this.sides,b.x=this.origin.x+this.radius*Math.cos(a),b.y=this.origin.y+this.radius*Math.sin(a),b.clearBounds()},calculateAngle:function(a,b){var c=Math.atan2(a.y-this.origin.y,a.x-this.origin.x);if(this.snapAngle&&this.snapToggle&&!b[this.snapToggle]){var d=Math.PI/180*this.snapAngle;this.angle=Math.round(c/d)*d}else this.angle=c},cancel:function(){this.callback("cancel",null);this.finalize()},finalize:function(){this.origin=null;this.radius=this.options.radius},clear:function(){this.layer&&(this.layer.renderer.clear(),this.layer.destroyFeatures())},callback:function(a){this.callbacks[a]&&this.callbacks[a].apply(this.control,[this.feature.geometry.clone()]);!this.persist&&("done"==a||"cancel"==a)&&this.clear()},CLASS_NAME:"OpenLayers.Handler.RegularPolygon"});OpenLayers.Control.SLDSelect=OpenLayers.Class(OpenLayers.Control,{clearOnDeactivate:!1,layers:null,callbacks:null,selectionSymbolizer:{Polygon:{fillColor:"#FF0000",stroke:!1},Line:{strokeColor:"#FF0000",strokeWidth:2},Point:{graphicName:"square",fillColor:"#FF0000",pointRadius:5}},layerOptions:null,handlerOptions:null,sketchStyle:null,wfsCache:{},layerCache:{},initialize:function(a,b){OpenLayers.Control.prototype.initialize.apply(this,[b]);this.callbacks=OpenLayers.Util.extend({done:this.select,click:this.select},this.callbacks);this.handlerOptions=this.handlerOptions||{};this.layerOptions=OpenLayers.Util.applyDefaults(this.layerOptions,{displayInLayerSwitcher:!1,tileOptions:{maxGetUrlLength:2048}});this.sketchStyle&&(this.handlerOptions.layerOptions=OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions,{styleMap:new OpenLayers.StyleMap({"default":this.sketchStyle})}));this.handler=new a(this,this.callbacks,this.handlerOptions)},destroy:function(){for(var a in this.layerCache)delete this.layerCache[a];for(a in this.wfsCache)delete this.wfsCache[a];OpenLayers.Control.prototype.destroy.apply(this,arguments)},coupleLayerVisiblity:function(a){this.setVisibility(a.object.getVisibility())},createSelectionLayer:function(a){var b;if(this.layerCache[a.id])b=this.layerCache[a.id];else{b=new OpenLayers.Layer.WMS(a.name,a.url,a.params,OpenLayers.Util.applyDefaults(this.layerOptions,a.getOptions()));this.layerCache[a.id]=b;if(!1===this.layerOptions.displayInLayerSwitcher)a.events.on({visibilitychanged:this.coupleLayerVisiblity,scope:b});this.map.addLayer(b)}return b},createSLD:function(a,b,c){for(var d={version:"1.0.0",namedLayers:{}},e=(""+a.params.LAYERS).split(","),f=0,g=e.length;f<g;f++){var h=e[f];d.namedLayers[h]={name:h,userStyles:[]};var i=this.selectionSymbolizer,j=c[f];0<=j.type.indexOf("Polygon")?i={Polygon:this.selectionSymbolizer.Polygon}:0<=j.type.indexOf("LineString")?i={Line:this.selectionSymbolizer.Line}:0<=j.type.indexOf("Point")&&(i={Point:this.selectionSymbolizer.Point});d.namedLayers[h].userStyles.push({name:"default",rules:[new OpenLayers.Rule({symbolizer:i,filter:b[f],maxScaleDenominator:a.options.minScale})]})}return new OpenLayers.Format.SLD({srsName:this.map.getProjection()}).write(d)},parseDescribeLayer:function(a){var b=new OpenLayers.Format.WMSDescribeLayer,c=a.responseXML;if(!c||!c.documentElement)c=a.responseText;for(var a=b.read(c),b=[],c=null,d=0,e=a.length;d<e;d++)"WFS"==a[d].owsType&&(b.push(a[d].typeName),c=a[d].owsURL);OpenLayers.Request.GET({url:c,params:{SERVICE:"WFS",TYPENAME:b.toString(),REQUEST:"DescribeFeatureType",VERSION:"1.0.0"},callback:function(a){var b=new OpenLayers.Format.WFSDescribeFeatureType,c=a.responseXML;if(!c||!c.documentElement)c=a.responseText;this.control.wfsCache[this.layer.id]=b.read(c);this.control._queue&&this.control.applySelection()},scope:this})},getGeometryAttributes:function(a){for(var b=[],a=this.wfsCache[a.id],c=0,d=a.featureTypes.length;c<d;c++)for(var e=a.featureTypes[c].properties,f=0,g=e.length;f<g;f++){var h=e[f],i=h.type;(0<=i.indexOf("LineString")||0<=i.indexOf("GeometryAssociationType")||0<=i.indexOf("GeometryPropertyType")||0<=i.indexOf("Point")||0<=i.indexOf("Polygon"))&&b.push(h)}return b},activate:function(){var a=OpenLayers.Control.prototype.activate.call(this);if(a)for(var b=0,c=this.layers.length;b<c;b++){var d=this.layers[b];d&&!this.wfsCache[d.id]&&OpenLayers.Request.GET({url:d.url,params:{SERVICE:"WMS",VERSION:d.params.VERSION,LAYERS:d.params.LAYERS,REQUEST:"DescribeLayer"},callback:this.parseDescribeLayer,scope:{layer:d,control:this}})}return a},deactivate:function(){var a=OpenLayers.Control.prototype.deactivate.call(this);if(a)for(var b=0,c=this.layers.length;b<c;b++){var d=this.layers[b];if(d&&!0===this.clearOnDeactivate){var e=this.layerCache,f=e[d.id];f&&(d.events.un({visibilitychanged:this.coupleLayerVisiblity,scope:f}),f.destroy(),delete e[d.id])}}return a},setLayers:function(a){this.active?(this.deactivate(),this.layers=a,this.activate()):this.layers=a},createFilter:function(a,b){var c=null;this.handler instanceof OpenLayers.Handler.RegularPolygon?c=!0===this.handler.irregular?new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.BBOX,property:a.name,value:b.getBounds()}):new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.INTERSECTS,property:a.name,value:b}):this.handler instanceof OpenLayers.Handler.Polygon?c=new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.INTERSECTS,property:a.name,value:b}):this.handler instanceof OpenLayers.Handler.Path?c=0<=a.type.indexOf("Point")?new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.DWITHIN,property:a.name,distance:.01*this.map.getExtent().getWidth(),distanceUnits:this.map.getUnits(),value:b}):new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.INTERSECTS,property:a.name,value:b}):this.handler instanceof OpenLayers.Handler.Click&&(c=0<=a.type.indexOf("Polygon")?new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.INTERSECTS,property:a.name,value:b}):new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.DWITHIN,property:a.name,distance:.01*this.map.getExtent().getWidth(),distanceUnits:this.map.getUnits(),value:b}));return c},select:function(a){this._queue=function(){for(var b=0,c=this.layers.length;b<c;b++){for(var d=this.layers[b],e=this.getGeometryAttributes(d),f=[],g=0,h=e.length;g<h;g++){var i=e[g];if(null!==i){if(!(a instanceof OpenLayers.Geometry)){var j=this.map.getLonLatFromPixel(a.xy);a=new OpenLayers.Geometry.Point(j.lon,j.lat)}i=this.createFilter(i,a);null!==i&&f.push(i)}}g=this.createSelectionLayer(d);e=this.createSLD(d,f,e);this.events.triggerEvent("selected",{layer:d,filters:f});g.mergeNewParams({SLD_BODY:e});delete this._queue}};this.applySelection()},applySelection:function(){for(var a=!0,b=0,c=this.layers.length;b<c;b++)if(!this.wfsCache[this.layers[b].id]){a=!1;break}a&&this._queue.call(this)},CLASS_NAME:"OpenLayers.Control.SLDSelect"});OpenLayers.Control.Scale=OpenLayers.Class(OpenLayers.Control,{element:null,geodesic:!1,initialize:function(a,b){OpenLayers.Control.prototype.initialize.apply(this,[b]);this.element=OpenLayers.Util.getElement(a)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.element||(this.element=document.createElement("div"),this.div.appendChild(this.element));this.map.events.register("moveend",this,this.updateScale);this.updateScale();return this.div},updateScale:function(){var a;if(!0===this.geodesic){if(!this.map.getUnits())return;a=OpenLayers.INCHES_PER_UNIT;a=(this.map.getGeodesicPixelSize().w||1e-6)*a.km*OpenLayers.DOTS_PER_INCH}else a=this.map.getScale();a&&(a=9500<=a&&95e4>=a?Math.round(a/1e3)+"K":95e4<=a?Math.round(a/1e6)+"M":Math.round(a),this.element.innerHTML=OpenLayers.i18n("Scale = 1 : ${scaleDenom}",{scaleDenom:a}))},CLASS_NAME:"OpenLayers.Control.Scale"});OpenLayers.Control.Button=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){},CLASS_NAME:"OpenLayers.Control.Button"});OpenLayers.Layer.MapGuide=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:!0,useHttpTile:!1,singleTile:!1,useOverlay:!1,useAsyncOverlay:!0,TILE_PARAMS:{operation:"GETTILEIMAGE",version:"1.2.0"},SINGLE_TILE_PARAMS:{operation:"GETMAPIMAGE",format:"PNG",locale:"en",clip:"1",version:"1.0.0"},OVERLAY_PARAMS:{operation:"GETDYNAMICMAPOVERLAYIMAGE",format:"PNG",locale:"en",clip:"1",version:"2.0.0"},FOLDER_PARAMS:{tileColumnsPerFolder:30,tileRowsPerFolder:30,format:"png",querystring:null},defaultSize:new OpenLayers.Size(300,300),tileOriginCorner:"tl",initialize:function(a,b,c,d){OpenLayers.Layer.Grid.prototype.initialize.apply(this,arguments);if(null==d||null==d.isBaseLayer)this.isBaseLayer="true"!=this.transparent&&!0!=this.transparent;d&&null!=d.useOverlay&&(this.useOverlay=d.useOverlay);this.singleTile?this.useOverlay?(OpenLayers.Util.applyDefaults(this.params,this.OVERLAY_PARAMS),this.useAsyncOverlay||(this.params.version="1.0.0")):OpenLayers.Util.applyDefaults(this.params,this.SINGLE_TILE_PARAMS):(this.useHttpTile?OpenLayers.Util.applyDefaults(this.params,this.FOLDER_PARAMS):OpenLayers.Util.applyDefaults(this.params,this.TILE_PARAMS),this.setTileSize(this.defaultSize))},clone:function(a){null==a&&(a=new OpenLayers.Layer.MapGuide(this.name,this.url,this.params,this.getOptions()));return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a])},getURL:function(a){var b;b=a.getCenterLonLat();var c=this.map.getSize();this.singleTile?(a={setdisplaydpi:OpenLayers.DOTS_PER_INCH,setdisplayheight:c.h*this.ratio,setdisplaywidth:c.w*this.ratio,setviewcenterx:b.lon,setviewcentery:b.lat,setviewscale:this.map.getScale()},this.useOverlay&&!this.useAsyncOverlay&&(b={},b=OpenLayers.Util.extend(b,a),b.operation="GETVISIBLEMAPEXTENT",b.version="1.0.0",b.session=this.params.session,b.mapName=this.params.mapName,b.format="text/xml",b=this.getFullRequestString(b),OpenLayers.Request.GET({url:b,async:!1})),b=this.getFullRequestString(a)):(c=this.map.getResolution(),b=Math.floor((a.left-this.maxExtent.left)/c),b=Math.round(b/this.tileSize.w),a=Math.floor((this.maxExtent.top-a.top)/c),a=Math.round(a/this.tileSize.h),b=this.useHttpTile?this.getImageFilePath({tilecol:b,tilerow:a,scaleindex:this.resolutions.length-this.map.zoom-1}):this.getFullRequestString({tilecol:b,tilerow:a,scaleindex:this.resolutions.length-this.map.zoom-1}));return b},getFullRequestString:function(a,b){var c=null==b?this.url:b;"object"==typeof c&&(c=c[Math.floor(Math.random()*c.length)]);var d=c,e=OpenLayers.Util.extend({},this.params),e=OpenLayers.Util.extend(e,a),f=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(c)),g;for(g in e)g.toUpperCase()in f&&delete e[g];e=OpenLayers.Util.getParameterString(e);e=e.replace(/,/g,"+");""!=e&&(f=c.charAt(c.length-1),d="&"==f||"?"==f?d+e:-1==c.indexOf("?")?d+("?"+e):d+("&"+e));return d},getImageFilePath:function(a,b){var c=null==b?this.url:b;"object"==typeof c&&(c=c[Math.floor(Math.random()*c.length)]);var d="",e="";0>a.tilerow&&(d="-");d=0==a.tilerow?d+"0":d+Math.floor(Math.abs(a.tilerow/this.params.tileRowsPerFolder))*this.params.tileRowsPerFolder;0>a.tilecol&&(e="-");e=0==a.tilecol?e+"0":e+Math.floor(Math.abs(a.tilecol/this.params.tileColumnsPerFolder))*this.params.tileColumnsPerFolder;d="/S"+Math.floor(a.scaleindex)+"/"+this.params.basemaplayergroupname+"/R"+d+"/C"+e+"/"+a.tilerow%this.params.tileRowsPerFolder+"_"+a.tilecol%this.params.tileColumnsPerFolder+"."+this.params.format;this.params.querystring&&(d+="?"+this.params.querystring);return c+d},calculateGridLayout:function(a,b,c){var d=c*this.tileSize.w,c=c*this.tileSize.h,e=a.left-b.lon,f=Math.floor(e/d)-this.buffer,a=b.lat-a.top+c,g=Math.floor(a/c)-this.buffer;return{tilelon:d,tilelat:c,tileoffsetlon:b.lon+f*d,tileoffsetlat:b.lat-c*g,tileoffsetx:-(e/d-f)*this.tileSize.w,tileoffsety:(g-a/c)*this.tileSize.h}},CLASS_NAME:"OpenLayers.Layer.MapGuide"});OpenLayers.Control.Measure=OpenLayers.Class(OpenLayers.Control,{handlerOptions:null,callbacks:null,displaySystem:"metric",geodesic:!1,displaySystemUnits:{geographic:["dd"],english:["mi","ft","in"],metric:["km","m"]},partialDelay:300,delayedTrigger:null,persist:!1,immediate:!1,initialize:function(a,b){OpenLayers.Control.prototype.initialize.apply(this,[b]);var c={done:this.measureComplete,point:this.measurePartial};this.immediate&&(c.modify=this.measureImmediate);this.callbacks=OpenLayers.Util.extend(c,this.callbacks);this.handlerOptions=OpenLayers.Util.extend({persist:this.persist},this.handlerOptions);this.handler=new a(this,this.callbacks,this.handlerOptions)},deactivate:function(){this.cancelDelay();return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},cancel:function(){this.cancelDelay();this.handler.cancel()},setImmediate:function(a){(this.immediate=a)?this.callbacks.modify=this.measureImmediate:delete this.callbacks.modify},updateHandler:function(a,b){var c=this.active;c&&this.deactivate();this.handler=new a(this,this.callbacks,b);c&&this.activate()},measureComplete:function(a){this.cancelDelay();this.measure(a,"measure")},measurePartial:function(a,b){this.cancelDelay();b=b.clone();this.handler.freehandMode(this.handler.evt)?this.measure(b,"measurepartial"):this.delayedTrigger=window.setTimeout(OpenLayers.Function.bind(function(){this.delayedTrigger=null;this.measure(b,"measurepartial")},this),this.partialDelay)},measureImmediate:function(a,b,c){c&&!this.handler.freehandMode(this.handler.evt)&&(this.cancelDelay(),this.measure(b.geometry,"measurepartial"))},cancelDelay:function(){null!==this.delayedTrigger&&(window.clearTimeout(this.delayedTrigger),this.delayedTrigger=null)},measure:function(a,b){var c,d;-1<a.CLASS_NAME.indexOf("LineString")?(c=this.getBestLength(a),d=1):(c=this.getBestArea(a),d=2);this.events.triggerEvent(b,{measure:c[0],units:c[1],order:d,geometry:a})},getBestArea:function(a){for(var b=this.displaySystemUnits[this.displaySystem],c,d,e=0,f=b.length;e<f&&!(c=b[e],d=this.getArea(a,c),1<d);++e);return[d,c]},getArea:function(a,b){var c,d;this.geodesic?(c=a.getGeodesicArea(this.map.getProjectionObject()),d="m"):(c=a.getArea(),d=this.map.getUnits());var e=OpenLayers.INCHES_PER_UNIT[b];e&&(c*=Math.pow(OpenLayers.INCHES_PER_UNIT[d]/e,2));return c},getBestLength:function(a){for(var b=this.displaySystemUnits[this.displaySystem],c,d,e=0,f=b.length;e<f&&!(c=b[e],d=this.getLength(a,c),1<d);++e);return[d,c]},getLength:function(a,b){var c,d;this.geodesic?(c=a.getGeodesicLength(this.map.getProjectionObject()),d="m"):(c=a.getLength(),d=this.map.getUnits());var e=OpenLayers.INCHES_PER_UNIT[b];e&&(c*=OpenLayers.INCHES_PER_UNIT[d]/e);return c},CLASS_NAME:"OpenLayers.Control.Measure"});OpenLayers.Format.WMC.v1_0_0=OpenLayers.Class(OpenLayers.Format.WMC.v1,{VERSION:"1.0.0",schemaLocation:"http://www.opengis.net/context http://schemas.opengis.net/context/1.0.0/context.xsd",initialize:function(a){OpenLayers.Format.WMC.v1.prototype.initialize.apply(this,[a])},read_wmc_SRS:function(a,b){var c=this.getChildValue(b);"object"!=typeof a.projections&&(a.projections={});for(var c=c.split(/ +/),d=0,e=c.length;d<e;d++)a.projections[c[d]]=!0},write_wmc_Layer:function(a){var b=OpenLayers.Format.WMC.v1.prototype.write_wmc_Layer.apply(this,[a]);if(a.srs){var c=[],d;for(d in a.srs)c.push(d);b.appendChild(this.createElementDefaultNS("SRS",c.join(" ")))}b.appendChild(this.write_wmc_FormatList(a));b.appendChild(this.write_wmc_StyleList(a));a.dimensions&&b.appendChild(this.write_wmc_DimensionList(a));b.appendChild(this.write_wmc_LayerExtension(a))},CLASS_NAME:"OpenLayers.Format.WMC.v1_0_0"});OpenLayers.Popup.Framed=OpenLayers.Class(OpenLayers.Popup.Anchored,{imageSrc:null,imageSize:null,isAlphaImage:!1,positionBlocks:null,blocks:null,fixedRelativePosition:!1,initialize:function(a,b,c,d,e,f,g){OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments);this.fixedRelativePosition&&(this.updateRelativePosition(),this.calculateRelativePosition=function(){return this.relativePosition});this.contentDiv.style.position="absolute";this.contentDiv.style.zIndex=1;f&&(this.closeDiv.style.zIndex=1);this.groupDiv.style.position="absolute";this.groupDiv.style.top="0px";this.groupDiv.style.left="0px";this.groupDiv.style.height="100%";this.groupDiv.style.width="100%"},destroy:function(){this.isAlphaImage=this.imageSize=this.imageSrc=null;this.fixedRelativePosition=!1;this.positionBlocks=null;for(var a=0;a<this.blocks.length;a++){var b=this.blocks[a];b.image&&b.div.removeChild(b.image);b.image=null;b.div&&this.groupDiv.removeChild(b.div);b.div=null}this.blocks=null;OpenLayers.Popup.Anchored.prototype.destroy.apply(this,arguments)},setBackgroundColor:function(){},setBorder:function(){},setOpacity:function(){},setSize:function(a){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.updateBlocks()},updateRelativePosition:function(){this.padding=this.positionBlocks[this.relativePosition].padding;if(this.closeDiv){var a=this.getContentDivPadding();this.closeDiv.style.right=a.right+this.padding.right+"px";this.closeDiv.style.top=a.top+this.padding.top+"px"}this.updateBlocks()},calculateNewPx:function(a){var b=OpenLayers.Popup.Anchored.prototype.calculateNewPx.apply(this,arguments);return b=b.offset(this.positionBlocks[this.relativePosition].offset)},createBlocks:function(){this.blocks=[];var a=null,b;for(b in this.positionBlocks){a=b;break}a=this.positionBlocks[a];for(b=0;b<a.blocks.length;b++){var c={};this.blocks.push(c);c.div=OpenLayers.Util.createDiv(this.id+"_FrameDecorationDiv_"+b,null,null,null,"absolute",null,"hidden",null);c.image=(this.isAlphaImage?OpenLayers.Util.createAlphaImageDiv:OpenLayers.Util.createImage)(this.id+"_FrameDecorationImg_"+b,null,this.imageSize,this.imageSrc,"absolute",null,null,null);c.div.appendChild(c.image);this.groupDiv.appendChild(c.div)}},updateBlocks:function(){this.blocks||this.createBlocks();if(this.size&&this.relativePosition){for(var a=this.positionBlocks[this.relativePosition],b=0;b<a.blocks.length;b++){var c=a.blocks[b],d=this.blocks[b],e=c.anchor.left,f=c.anchor.bottom,g=c.anchor.right,h=c.anchor.top,i=isNaN(c.size.w)?this.size.w-(g+e):c.size.w,j=isNaN(c.size.h)?this.size.h-(f+h):c.size.h;d.div.style.width=(0>i?0:i)+"px";d.div.style.height=(0>j?0:j)+"px";d.div.style.left=null!=e?e+"px":"";d.div.style.bottom=null!=f?f+"px":"";d.div.style.right=null!=g?g+"px":"";d.div.style.top=null!=h?h+"px":"";d.image.style.left=c.position.x+"px";d.image.style.top=c.position.y+"px"}this.contentDiv.style.left=this.padding.left+"px";this.contentDiv.style.top=this.padding.top+"px"}},CLASS_NAME:"OpenLayers.Popup.Framed"});OpenLayers.Popup.FramedCloud=OpenLayers.Class(OpenLayers.Popup.Framed,{contentDisplayClass:"olFramedCloudPopupContent",autoSize:!0,panMapIfOutOfView:!0,imageSize:new OpenLayers.Size(1276,736),isAlphaImage:!1,fixedRelativePosition:!1,positionBlocks:{tl:{offset:new OpenLayers.Pixel(44,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,50,0,0),position:new OpenLayers.Pixel(-1238,0)},{size:new OpenLayers.Size("auto",19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,18),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-1238,-632)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(0,-688)}]},tr:{offset:new OpenLayers.Pixel(-45,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,50,0,0),position:new OpenLayers.Pixel(-1238,0)},{size:new OpenLayers.Size("auto",19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,19),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-1238,-631)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(0,0,null,null),position:new OpenLayers.Pixel(-215,-687)}]},bl:{offset:new OpenLayers.Pixel(45,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-1238,0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-1238,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(null,null,0,0),position:new OpenLayers.Pixel(-101,-674)}]},br:{offset:new OpenLayers.Pixel(-44,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-1238,0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-1238,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(0,null,null,0),position:new OpenLayers.Pixel(-311,-674)}]}},minSize:new OpenLayers.Size(105,10),maxSize:new OpenLayers.Size(1200,660),initialize:function(a,b,c,d,e,f,g){this.imageSrc=OpenLayers.Util.getImageLocation("cloud-popup-relative.png");OpenLayers.Popup.Framed.prototype.initialize.apply(this,arguments);this.contentDiv.className=this.contentDisplayClass},CLASS_NAME:"OpenLayers.Popup.FramedCloud"});OpenLayers.Tile.Image.IFrame={useIFrame:null,draw:function(){if(OpenLayers.Tile.Image.prototype.shouldDraw.call(this)){var a=this.layer.getURL(this.bounds),b=this.useIFrame;this.useIFrame=null!==this.maxGetUrlLength&&!this.layer.async&&a.length>this.maxGetUrlLength;a=b&&!this.useIFrame;b=!b&&this.useIFrame;if(a||b)this.imgDiv&&this.imgDiv.parentNode===this.frame&&this.frame.removeChild(this.imgDiv),this.imgDiv=null,a?(this.blankImageUrl=this._blankImageUrl,this.frame.removeChild(this.frame.firstChild)):(this._blankImageUrl=this.blankImageUrl,this.blankImageUrl="about:blank")}return OpenLayers.Tile.Image.prototype.draw.apply(this,arguments)},getImage:function(){if(!0===this.useIFrame){if(!this.frame.childNodes.length){var a=document.createElement("div"),b=a.style;b.position="absolute";b.width="100%";b.height="100%";b.zIndex=1;b.backgroundImage="url("+this._blankImageUrl+")";this.frame.appendChild(a)}a=this.id+"_iFrame";9>parseFloat(navigator.appVersion.split("MSIE")[1])?(b=document.createElement('<iframe name="'+a+'">'),b.style.backgroundColor="#FFFFFF",b.style.filter="chroma(color=#FFFFFF)"):(b=document.createElement("iframe"),b.style.backgroundColor="transparent",b.name=a);b.scrolling="no";b.marginWidth="0px";b.marginHeight="0px";b.frameBorder="0";b.style.position="absolute";b.style.width="100%";b.style.height="100%";1>this.layer.opacity&&OpenLayers.Util.modifyDOMElement(b,null,null,null,null,null,null,this.layer.opacity);this.frame.appendChild(b);return this.imgDiv=b}return OpenLayers.Tile.Image.prototype.getImage.apply(this,arguments)},createRequestForm:function(){var a=document.createElement("form");a.method="POST";var b=this.layer.params._OLSALT,b=(b?b+"_":"")+this.bounds.toBBOX();a.action=OpenLayers.Util.urlAppend(this.layer.url,b);a.target=this.id+"_iFrame";this.layer.getImageSize();var b=OpenLayers.Util.getParameters(this.url),c,d;for(d in b)c=document.createElement("input"),c.type="hidden",c.name=d,c.value=b[d],a.appendChild(c);return a},setImgSrc:function(a){if(!0===this.useIFrame)if(a){var b=this.createRequestForm();this.frame.appendChild(b);b.submit();this.frame.removeChild(b)}else this.imgDiv.parentNode===this.frame&&(this.frame.removeChild(this.imgDiv),this.imgDiv=null);else OpenLayers.Tile.Image.prototype.setImgSrc.apply(this,arguments)},onImageLoad:function(){OpenLayers.Tile.Image.prototype.onImageLoad.apply(this,arguments);!0===this.useIFrame&&(this.imgDiv.style.opacity=1,this.frame.style.opacity=this.layer.opacity)},createBackBuffer:function(){var a;!1===this.useIFrame&&(a=OpenLayers.Tile.Image.prototype.createBackBuffer.call(this));return a}};OpenLayers.Format.SOSCapabilities=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{defaultVersion:"1.0.0",CLASS_NAME:"OpenLayers.Format.SOSCapabilities"});OpenLayers.Format.SOSCapabilities.v1_0_0=OpenLayers.Class(OpenLayers.Format.SOSCapabilities,{namespaces:{ows:"http://www.opengis.net/ows/1.1",sos:"http://www.opengis.net/sos/1.0",gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink"},regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a]);this.options=a},read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a&&9==a.nodeType&&(a=a.documentElement);var b={};this.readNode(a,b);return b},readers:{gml:OpenLayers.Util.applyDefaults({name:function(a,b){b.name=this.getChildValue(a)},TimePeriod:function(a,b){b.timePeriod={};this.readChildNodes(a,b.timePeriod)},beginPosition:function(a,b){b.beginPosition=this.getChildValue(a)},endPosition:function(a,b){b.endPosition=this.getChildValue(a)}},OpenLayers.Format.GML.v3.prototype.readers.gml),sos:{Capabilities:function(a,b){this.readChildNodes(a,b)},Contents:function(a,b){b.contents={};this.readChildNodes(a,b.contents)},ObservationOfferingList:function(a,b){b.offeringList={};this.readChildNodes(a,b.offeringList)},ObservationOffering:function(a,b){var c=this.getAttributeNS(a,this.namespaces.gml,"id");b[c]={procedures:[],observedProperties:[],featureOfInterestIds:[],responseFormats:[],resultModels:[],responseModes:[]};this.readChildNodes(a,b[c])},time:function(a,b){b.time={};this.readChildNodes(a,b.time)},procedure:function(a,b){b.procedures.push(this.getAttributeNS(a,this.namespaces.xlink,"href"))},observedProperty:function(a,b){b.observedProperties.push(this.getAttributeNS(a,this.namespaces.xlink,"href"))},featureOfInterest:function(a,b){b.featureOfInterestIds.push(this.getAttributeNS(a,this.namespaces.xlink,"href"))},responseFormat:function(a,b){b.responseFormats.push(this.getChildValue(a))},resultModel:function(a,b){b.resultModels.push(this.getChildValue(a))},responseMode:function(a,b){b.responseModes.push(this.getChildValue(a))}},ows:OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers.ows},CLASS_NAME:"OpenLayers.Format.SOSCapabilities.v1_0_0"});OpenLayers.Handler.Pinch=OpenLayers.Class(OpenLayers.Handler,{started:!1,stopDown:!1,pinching:!1,last:null,start:null,touchstart:function(a){var b=!0;this.pinching=!1;OpenLayers.Event.isMultiTouch(a)?(this.started=!0,this.last=this.start={distance:this.getDistance(a.touches),delta:0,scale:1},this.callback("start",[a,this.start]),b=!this.stopDown):(this.started=!1,this.last=this.start=null);OpenLayers.Event.stop(a);return b},touchmove:function(a){if(this.started&&OpenLayers.Event.isMultiTouch(a)){this.pinching=!0;var b=this.getPinchData(a);this.callback("move",[a,b]);this.last=b;OpenLayers.Event.stop(a)}return!0},touchend:function(a){this.started&&(this.pinching=this.started=!1,this.callback("done",[a,this.start,this.last]),this.last=this.start=null);return!0},activate:function(){var a=!1;OpenLayers.Handler.prototype.activate.apply(this,arguments)&&(this.pinching=!1,a=!0);return a},deactivate:function(){var a=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.pinching=this.started=!1,this.last=this.start=null,a=!0);return a},getDistance:function(a){var b=a[0],a=a[1];return Math.sqrt(Math.pow(b.clientX-a.clientX,2)+Math.pow(b.clientY-a.clientY,2))},getPinchData:function(a){a=this.getDistance(a.touches);return{distance:a,delta:this.last.distance-a,scale:a/this.start.distance}},CLASS_NAME:"OpenLayers.Handler.Pinch"});OpenLayers.Control.NavToolbar=OpenLayers.Class(OpenLayers.Control.Panel,{initialize:function(a){OpenLayers.Control.Panel.prototype.initialize.apply(this,[a]);this.addControls([new OpenLayers.Control.Navigation,new OpenLayers.Control.ZoomBox])},draw:function(){var a=OpenLayers.Control.Panel.prototype.draw.apply(this,arguments);null===this.defaultControl&&(this.defaultControl=this.controls[0]);return a},CLASS_NAME:"OpenLayers.Control.NavToolbar"});OpenLayers.Strategy.Refresh=OpenLayers.Class(OpenLayers.Strategy,{force:!1,interval:0,timer:null,activate:function(){var a=OpenLayers.Strategy.prototype.activate.call(this);a&&(!0===this.layer.visibility&&this.start(),this.layer.events.on({visibilitychanged:this.reset,scope:this}));return a},deactivate:function(){var a=OpenLayers.Strategy.prototype.deactivate.call(this);a&&this.stop();return a},reset:function(){!0===this.layer.visibility?this.start():this.stop()},start:function(){this.interval&&("number"===typeof this.interval&&0<this.interval)&&(this.timer=window.setInterval(OpenLayers.Function.bind(this.refresh,this),this.interval))},refresh:function(){this.layer&&(this.layer.refresh&&"function"==typeof this.layer.refresh)&&this.layer.refresh({force:this.force})},stop:function(){null!==this.timer&&(window.clearInterval(this.timer),this.timer=null)},CLASS_NAME:"OpenLayers.Strategy.Refresh"});OpenLayers.Layer.ArcGIS93Rest=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{format:"png"},isBaseLayer:!0,initialize:function(a,b,c,d){var e=[],c=OpenLayers.Util.upperCaseObject(c);e.push(a,b,c,d);OpenLayers.Layer.Grid.prototype.initialize.apply(this,e);OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));if(this.params.TRANSPARENT&&"true"==this.params.TRANSPARENT.toString().toLowerCase()){if(null==d||!d.isBaseLayer)this.isBaseLayer=!1;"jpg"==this.params.FORMAT&&(this.params.FORMAT=OpenLayers.Util.alphaHack()?"gif":"png")}},clone:function(a){null==a&&(a=new OpenLayers.Layer.ArcGIS93Rest(this.name,this.url,this.params,this.getOptions()));return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a])},getURL:function(a){var a=this.adjustBounds(a),b=this.projection.getCode().split(":"),b=b[b.length-1],c=this.getImageSize(),a={BBOX:a.toBBOX(),SIZE:c.w+","+c.h,F:"image",BBOXSR:b,IMAGESR:b};if(this.layerDefs){var b=[],d;for(d in this.layerDefs)this.layerDefs.hasOwnProperty(d)&&this.layerDefs[d]&&(b.push(d),b.push(":"),b.push(this.layerDefs[d]),b.push(";"));0<b.length&&(a.LAYERDEFS=b.join(""))}return this.getFullRequestString(a)},setLayerFilter:function(a,b){this.layerDefs||(this.layerDefs={});b?this.layerDefs[a]=b:delete this.layerDefs[a]},clearLayerFilter:function(a){a?delete this.layerDefs[a]:delete this.layerDefs},mergeNewParams:function(a){a=[OpenLayers.Util.upperCaseObject(a)];
return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,a)},CLASS_NAME:"OpenLayers.Layer.ArcGIS93Rest"});OpenLayers.Format.WKT=OpenLayers.Class(OpenLayers.Format,{initialize:function(a){this.regExes={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/};OpenLayers.Format.prototype.initialize.apply(this,[a])},read:function(a){var b,c,a=a.replace(/[\n\r]/g," ");if(c=this.regExes.typeStr.exec(a))if(a=c[1].toLowerCase(),c=c[2],this.parse[a]&&(b=this.parse[a].apply(this,[c])),this.internalProjection&&this.externalProjection)if(b&&"OpenLayers.Feature.Vector"==b.CLASS_NAME)b.geometry.transform(this.externalProjection,this.internalProjection);else if(b&&"geometrycollection"!=a&&"object"==typeof b){a=0;for(c=b.length;a<c;a++)b[a].geometry.transform(this.externalProjection,this.internalProjection)}return b},write:function(a){var b,c;a.constructor==Array?c=!0:(a=[a],c=!1);var d=[];c&&d.push("GEOMETRYCOLLECTION(");for(var e=0,f=a.length;e<f;++e)c&&0<e&&d.push(","),b=a[e].geometry,d.push(this.extractGeometry(b));c&&d.push(")");return d.join("")},extractGeometry:function(a){var b=a.CLASS_NAME.split(".")[2].toLowerCase();if(!this.extract[b])return null;this.internalProjection&&this.externalProjection&&(a=a.clone(),a.transform(this.internalProjection,this.externalProjection));return("collection"==b?"GEOMETRYCOLLECTION":b.toUpperCase())+"("+this.extract[b].apply(this,[a])+")"},extract:{point:function(a){return a.x+" "+a.y},multipoint:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push("("+this.extract.point.apply(this,[a.components[c]])+")");return b.join(",")},linestring:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extract.point.apply(this,[a.components[c]]));return b.join(",")},multilinestring:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push("("+this.extract.linestring.apply(this,[a.components[c]])+")");return b.join(",")},polygon:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push("("+this.extract.linestring.apply(this,[a.components[c]])+")");return b.join(",")},multipolygon:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push("("+this.extract.polygon.apply(this,[a.components[c]])+")");return b.join(",")},collection:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extractGeometry.apply(this,[a.components[c]]));return b.join(",")}},parse:{point:function(a){a=OpenLayers.String.trim(a).split(this.regExes.spaces);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(a[0],a[1]))},multipoint:function(a){for(var b=OpenLayers.String.trim(a).split(","),c=[],d=0,e=b.length;d<e;++d)a=b[d].replace(this.regExes.trimParens,"$1"),c.push(this.parse.point.apply(this,[a]).geometry);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPoint(c))},linestring:function(a){for(var a=OpenLayers.String.trim(a).split(","),b=[],c=0,d=a.length;c<d;++c)b.push(this.parse.point.apply(this,[a[c]]).geometry);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(b))},multilinestring:function(a){for(var b=OpenLayers.String.trim(a).split(this.regExes.parenComma),c=[],d=0,e=b.length;d<e;++d)a=b[d].replace(this.regExes.trimParens,"$1"),c.push(this.parse.linestring.apply(this,[a]).geometry);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiLineString(c))},polygon:function(a){for(var b,a=OpenLayers.String.trim(a).split(this.regExes.parenComma),c=[],d=0,e=a.length;d<e;++d)b=a[d].replace(this.regExes.trimParens,"$1"),b=this.parse.linestring.apply(this,[b]).geometry,b=new OpenLayers.Geometry.LinearRing(b.components),c.push(b);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon(c))},multipolygon:function(a){for(var b=OpenLayers.String.trim(a).split(this.regExes.doubleParenComma),c=[],d=0,e=b.length;d<e;++d)a=b[d].replace(this.regExes.trimParens,"$1"),c.push(this.parse.polygon.apply(this,[a]).geometry);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPolygon(c))},geometrycollection:function(a){for(var a=a.replace(/,\s*([A-Za-z])/g,"|$1"),a=OpenLayers.String.trim(a).split("|"),b=[],c=0,d=a.length;c<d;++c)b.push(OpenLayers.Format.WKT.prototype.read.apply(this,[a[c]]));return b}},CLASS_NAME:"OpenLayers.Format.WKT"});OpenLayers.Handler.Hover=OpenLayers.Class(OpenLayers.Handler,{delay:500,pixelTolerance:null,stopMove:!1,px:null,timerId:null,mousemove:function(a){this.passesTolerance(a.xy)&&(this.clearTimer(),this.callback("move",[a]),this.px=a.xy,a=OpenLayers.Util.extend({},a),this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,a),this.delay));return!this.stopMove},mouseout:function(a){OpenLayers.Util.mouseLeft(a,this.map.viewPortDiv)&&(this.clearTimer(),this.callback("move",[a]));return!0},passesTolerance:function(a){var b=!0;this.pixelTolerance&&this.px&&Math.sqrt(Math.pow(this.px.x-a.x,2)+Math.pow(this.px.y-a.y,2))<this.pixelTolerance&&(b=!1);return b},clearTimer:function(){null!=this.timerId&&(window.clearTimeout(this.timerId),this.timerId=null)},delayedCall:function(a){this.callback("pause",[a])},deactivate:function(){var a=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.clearTimer(),a=!0);return a},CLASS_NAME:"OpenLayers.Handler.Hover"});OpenLayers.Control.GetFeature=OpenLayers.Class(OpenLayers.Control,{protocol:null,multipleKey:null,toggleKey:null,modifiers:null,multiple:!1,click:!0,single:!0,clickout:!0,toggle:!1,clickTolerance:5,hover:!1,box:!1,maxFeatures:10,features:null,hoverFeature:null,handlerOptions:null,handlers:null,hoverResponse:null,filterType:OpenLayers.Filter.Spatial.BBOX,initialize:function(a){a.handlerOptions=a.handlerOptions||{};OpenLayers.Control.prototype.initialize.apply(this,[a]);this.features={};this.handlers={};this.click&&(this.handlers.click=new OpenLayers.Handler.Click(this,{click:this.selectClick},this.handlerOptions.click||{}));this.box&&(this.handlers.box=new OpenLayers.Handler.Box(this,{done:this.selectBox},OpenLayers.Util.extend(this.handlerOptions.box,{boxDivClassName:"olHandlerBoxSelectFeature"})));this.hover&&(this.handlers.hover=new OpenLayers.Handler.Hover(this,{move:this.cancelHover,pause:this.selectHover},OpenLayers.Util.extend(this.handlerOptions.hover,{delay:250,pixelTolerance:2})))},activate:function(){if(!this.active)for(var a in this.handlers)this.handlers[a].activate();return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){if(this.active)for(var a in this.handlers)this.handlers[a].deactivate();return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},selectClick:function(a){var b=this.pixelToBounds(a.xy);this.setModifiers(a);this.request(b,{single:this.single})},selectBox:function(a){var b;if(a instanceof OpenLayers.Bounds)b=this.map.getLonLatFromPixel({x:a.left,y:a.bottom}),a=this.map.getLonLatFromPixel({x:a.right,y:a.top}),b=new OpenLayers.Bounds(b.lon,b.lat,a.lon,a.lat);else{if(this.click)return;b=this.pixelToBounds(a)}this.setModifiers(this.handlers.box.dragHandler.evt);this.request(b)},selectHover:function(a){this.request(this.pixelToBounds(a.xy),{single:!0,hover:!0})},cancelHover:function(){this.hoverResponse&&(this.protocol.abort(this.hoverResponse),this.hoverResponse=null,OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait"))},request:function(a,b){var b=b||{},c=new OpenLayers.Filter.Spatial({type:this.filterType,value:a});OpenLayers.Element.addClass(this.map.viewPortDiv,"olCursorWait");c=this.protocol.read({maxFeatures:!0==b.single?this.maxFeatures:void 0,filter:c,callback:function(c){c.success()&&(c.features.length?!0==b.single?this.selectBestFeature(c.features,a.getCenterLonLat(),b):this.select(c.features):b.hover?this.hoverSelect():(this.events.triggerEvent("clickout"),this.clickout&&this.unselectAll()));OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait")},scope:this});!0==b.hover&&(this.hoverResponse=c)},selectBestFeature:function(a,b,c){c=c||{};if(a.length){for(var b=new OpenLayers.Geometry.Point(b.lon,b.lat),d,e,f,g=Number.MAX_VALUE,h=0;h<a.length&&!(d=a[h],d.geometry&&(f=b.distanceTo(d.geometry,{edge:!1}),f<g&&(g=f,e=d,0==g)));++h);!0==c.hover?this.hoverSelect(e):this.select(e||a)}},setModifiers:function(a){this.modifiers={multiple:this.multiple||this.multipleKey&&a[this.multipleKey],toggle:this.toggle||this.toggleKey&&a[this.toggleKey]}},select:function(a){!this.modifiers.multiple&&!this.modifiers.toggle&&this.unselectAll();OpenLayers.Util.isArray(a)||(a=[a]);var b=this.events.triggerEvent("beforefeaturesselected",{features:a});if(!1!==b){for(var c=[],d,e=0,f=a.length;e<f;++e)d=a[e],this.features[d.fid||d.id]?this.modifiers.toggle&&this.unselect(this.features[d.fid||d.id]):(b=this.events.triggerEvent("beforefeatureselected",{feature:d}),!1!==b&&(this.features[d.fid||d.id]=d,c.push(d),this.events.triggerEvent("featureselected",{feature:d})));this.events.triggerEvent("featuresselected",{features:c})}},hoverSelect:function(a){var b=a?a.fid||a.id:null,c=this.hoverFeature?this.hoverFeature.fid||this.hoverFeature.id:null;c&&c!=b&&(this.events.triggerEvent("outfeature",{feature:this.hoverFeature}),this.hoverFeature=null);b&&b!=c&&(this.events.triggerEvent("hoverfeature",{feature:a}),this.hoverFeature=a)},unselect:function(a){delete this.features[a.fid||a.id];this.events.triggerEvent("featureunselected",{feature:a})},unselectAll:function(){for(var a in this.features)this.unselect(this.features[a])},setMap:function(a){for(var b in this.handlers)this.handlers[b].setMap(a);OpenLayers.Control.prototype.setMap.apply(this,arguments)},pixelToBounds:function(a){var b=a.add(-this.clickTolerance/2,this.clickTolerance/2),a=a.add(this.clickTolerance/2,-this.clickTolerance/2),b=this.map.getLonLatFromPixel(b),a=this.map.getLonLatFromPixel(a);return new OpenLayers.Bounds(b.lon,b.lat,a.lon,a.lat)},CLASS_NAME:"OpenLayers.Control.GetFeature"});OpenLayers.Format.QueryStringFilter=function(){function a(a){a=a.replace(/%/g,"\\%");a=a.replace(/\\\\\.(\*)?/g,function(a,b){return b?a:"\\\\_"});a=a.replace(/\\\\\.\*/g,"\\\\%");a=a.replace(/(\\)?\.(\*)?/g,function(a,b,c){return b||c?a:"_"});a=a.replace(/(\\)?\.\*/g,function(a,b){return b?a:"%"});a=a.replace(/\\\./g,".");return a=a.replace(/(\\)?\\\*/g,function(a,b){return b?a:"*"})}var b={};b[OpenLayers.Filter.Comparison.EQUAL_TO]="eq";b[OpenLayers.Filter.Comparison.NOT_EQUAL_TO]="ne";b[OpenLayers.Filter.Comparison.LESS_THAN]="lt";b[OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO]="lte";b[OpenLayers.Filter.Comparison.GREATER_THAN]="gt";b[OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO]="gte";b[OpenLayers.Filter.Comparison.LIKE]="ilike";return OpenLayers.Class(OpenLayers.Format,{wildcarded:!1,srsInBBOX:!1,write:function(c,d){var d=d||{},e=c.CLASS_NAME,e=e.substring(e.lastIndexOf(".")+1);switch(e){case"Spatial":switch(c.type){case OpenLayers.Filter.Spatial.BBOX:d.bbox=c.value.toArray();this.srsInBBOX&&c.projection&&d.bbox.push(c.projection.getCode());break;case OpenLayers.Filter.Spatial.DWITHIN:d.tolerance=c.distance;case OpenLayers.Filter.Spatial.WITHIN:d.lon=c.value.x;d.lat=c.value.y;break;default:OpenLayers.Console.warn("Unknown spatial filter type "+c.type)}break;case"Comparison":e=b[c.type];if(void 0!==e){var f=c.value;c.type==OpenLayers.Filter.Comparison.LIKE&&(f=a(f),this.wildcarded&&(f="%"+f+"%"));d[c.property+"__"+e]=f;d.queryable=d.queryable||[];d.queryable.push(c.property)}else OpenLayers.Console.warn("Unknown comparison filter type "+c.type);break;case"Logical":if(c.type===OpenLayers.Filter.Logical.AND){e=0;for(f=c.filters.length;e<f;e++)d=this.write(c.filters[e],d)}else OpenLayers.Console.warn("Unsupported logical filter type "+c.type);break;default:OpenLayers.Console.warn("Unknown filter type "+e)}return d},CLASS_NAME:"OpenLayers.Format.QueryStringFilter"})}();OpenLayers.Control.MousePosition=OpenLayers.Class(OpenLayers.Control,{autoActivate:!0,element:null,prefix:"",separator:", ",suffix:"",numDigits:5,granularity:10,emptyString:null,lastXy:null,displayProjection:null,destroy:function(){this.deactivate();OpenLayers.Control.prototype.destroy.apply(this,arguments)},activate:function(){return OpenLayers.Control.prototype.activate.apply(this,arguments)?(this.map.events.register("mousemove",this,this.redraw),this.map.events.register("mouseout",this,this.reset),this.redraw(),!0):!1},deactivate:function(){return OpenLayers.Control.prototype.deactivate.apply(this,arguments)?(this.map.events.unregister("mousemove",this,this.redraw),this.map.events.unregister("mouseout",this,this.reset),this.element.innerHTML="",!0):!1},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.element||(this.div.left="",this.div.top="",this.element=this.div);return this.div},redraw:function(a){var b;if(null==a)this.reset();else if(null==this.lastXy||Math.abs(a.xy.x-this.lastXy.x)>this.granularity||Math.abs(a.xy.y-this.lastXy.y)>this.granularity)this.lastXy=a.xy;else if(b=this.map.getLonLatFromPixel(a.xy))this.displayProjection&&b.transform(this.map.getProjectionObject(),this.displayProjection),this.lastXy=a.xy,a=this.formatOutput(b),a!=this.element.innerHTML&&(this.element.innerHTML=a)},reset:function(){null!=this.emptyString&&(this.element.innerHTML=this.emptyString)},formatOutput:function(a){var b=parseInt(this.numDigits);return this.prefix+a.lon.toFixed(b)+this.separator+a.lat.toFixed(b)+this.suffix},CLASS_NAME:"OpenLayers.Control.MousePosition"});OpenLayers.Control.Geolocate=OpenLayers.Class(OpenLayers.Control,{geolocation:navigator.geolocation,bind:!0,watch:!1,geolocationOptions:null,destroy:function(){this.deactivate();OpenLayers.Control.prototype.destroy.apply(this,arguments)},activate:function(){return!this.geolocation?(this.events.triggerEvent("locationuncapable"),!1):OpenLayers.Control.prototype.activate.apply(this,arguments)?(this.watch?this.watchId=this.geolocation.watchPosition(OpenLayers.Function.bind(this.geolocate,this),OpenLayers.Function.bind(this.failure,this),this.geolocationOptions):this.getCurrentLocation(),!0):!1},deactivate:function(){this.active&&null!==this.watchId&&this.geolocation.clearWatch(this.watchId);return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},geolocate:function(a){var b=new OpenLayers.LonLat(a.coords.longitude,a.coords.latitude).transform(new OpenLayers.Projection("EPSG:4326"),this.map.getProjectionObject());this.bind&&this.map.setCenter(b);this.events.triggerEvent("locationupdated",{position:a,point:new OpenLayers.Geometry.Point(b.lon,b.lat)})},getCurrentLocation:function(){if(!this.active||this.watch)return!1;this.geolocation.getCurrentPosition(OpenLayers.Function.bind(this.geolocate,this),OpenLayers.Function.bind(this.failure,this),this.geolocationOptions);return!0},failure:function(a){this.events.triggerEvent("locationfailed",{error:a})},CLASS_NAME:"OpenLayers.Control.Geolocate"});OpenLayers.Tile.UTFGrid=OpenLayers.Class(OpenLayers.Tile,{url:null,utfgridResolution:2,json:null,format:null,destroy:function(){this.clear();OpenLayers.Tile.prototype.destroy.apply(this,arguments)},draw:function(){var a=OpenLayers.Tile.prototype.draw.apply(this,arguments);if(a)if(this.isLoading?(this.abortLoading(),this.events.triggerEvent("reload")):(this.isLoading=!0,this.events.triggerEvent("loadstart")),this.url=this.layer.getURL(this.bounds),this.layer.useJSONP){var b=new OpenLayers.Protocol.Script({url:this.url,callback:function(a){this.isLoading=false;this.events.triggerEvent("loadend");this.json=a.data},scope:this});b.read();this.request=b}else this.request=OpenLayers.Request.GET({url:this.url,callback:function(a){this.isLoading=false;this.events.triggerEvent("loadend");a.status===200&&this.parseData(a.responseText)},scope:this});else this.unload();return a},abortLoading:function(){this.request&&(this.request.abort(),delete this.request);this.isLoading=!1},getFeatureInfo:function(a,b){var c=null;if(this.json){var d=this.getFeatureId(a,b);null!==d&&(c={id:d,data:this.json.data[d]})}return c},getFeatureId:function(a,b){var c=null;if(this.json){var d=this.utfgridResolution,d=this.indexFromCharCode(this.json.grid[Math.floor(b/d)].charCodeAt(Math.floor(a/d))),e=this.json.keys;!isNaN(d)&&d in e&&(c=e[d])}return c},indexFromCharCode:function(a){93<=a&&a--;35<=a&&a--;return a-32},parseData:function(a){this.format||(this.format=new OpenLayers.Format.JSON);this.json=this.format.read(a)},clear:function(){this.json=null},CLASS_NAME:"OpenLayers.Tile.UTFGrid"});OpenLayers.Control.NavigationHistory=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOGGLE,previous:null,previousOptions:null,next:null,nextOptions:null,limit:50,autoActivate:!0,clearOnDeactivate:!1,registry:null,nextStack:null,previousStack:null,listeners:null,restoring:!1,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.registry=OpenLayers.Util.extend({moveend:this.getState},this.registry);a={trigger:OpenLayers.Function.bind(this.previousTrigger,this),displayClass:this.displayClass+" "+this.displayClass+"Previous"};OpenLayers.Util.extend(a,this.previousOptions);this.previous=new OpenLayers.Control.Button(a);a={trigger:OpenLayers.Function.bind(this.nextTrigger,this),displayClass:this.displayClass+" "+this.displayClass+"Next"};OpenLayers.Util.extend(a,this.nextOptions);this.next=new OpenLayers.Control.Button(a);this.clear()},onPreviousChange:function(a){a&&!this.previous.active?this.previous.activate():!a&&this.previous.active&&this.previous.deactivate()},onNextChange:function(a){a&&!this.next.active?this.next.activate():!a&&this.next.active&&this.next.deactivate()},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this);this.previous.destroy();this.next.destroy();this.deactivate();for(var a in this)this[a]=null},setMap:function(a){this.map=a;this.next.setMap(a);this.previous.setMap(a)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.next.draw();this.previous.draw()},previousTrigger:function(){var a=this.previousStack.shift(),b=this.previousStack.shift();void 0!=b?(this.nextStack.unshift(a),this.previousStack.unshift(b),this.restoring=!0,this.restore(b),this.restoring=!1,this.onNextChange(this.nextStack[0],this.nextStack.length),this.onPreviousChange(this.previousStack[1],this.previousStack.length-1)):this.previousStack.unshift(a);return b},nextTrigger:function(){var a=this.nextStack.shift();void 0!=a&&(this.previousStack.unshift(a),this.restoring=!0,this.restore(a),this.restoring=!1,this.onNextChange(this.nextStack[0],this.nextStack.length),this.onPreviousChange(this.previousStack[1],this.previousStack.length-1));return a},clear:function(){this.previousStack=[];this.previous.deactivate();this.nextStack=[];this.next.deactivate()},getState:function(){return{center:this.map.getCenter(),resolution:this.map.getResolution(),projection:this.map.getProjectionObject(),units:this.map.getProjectionObject().getUnits()||this.map.units||this.map.baseLayer.units}},restore:function(a){var b,c;if(this.map.getProjectionObject()==a.projection)c=this.map.getZoomForResolution(a.resolution),b=a.center;else{b=a.center.clone();b.transform(a.projection,this.map.getProjectionObject());c=a.units;var d=this.map.getProjectionObject().getUnits()||this.map.units||this.map.baseLayer.units;c=this.map.getZoomForResolution((c&&d?OpenLayers.INCHES_PER_UNIT[c]/OpenLayers.INCHES_PER_UNIT[d]:1)*a.resolution)}this.map.setCenter(b,c)},setListeners:function(){this.listeners={};for(var a in this.registry)this.listeners[a]=OpenLayers.Function.bind(function(){if(!this.restoring){this.previousStack.unshift(this.registry[a].apply(this,arguments));if(1<this.previousStack.length)this.onPreviousChange(this.previousStack[1],this.previousStack.length-1);this.previousStack.length>this.limit+1&&this.previousStack.pop();0<this.nextStack.length&&(this.nextStack=[],this.onNextChange(null,0))}return!0},this)},activate:function(){var a=!1;if(this.map&&OpenLayers.Control.prototype.activate.apply(this)){null==this.listeners&&this.setListeners();for(var b in this.listeners)this.map.events.register(b,this,this.listeners[b]);a=!0;0==this.previousStack.length&&this.initStack()}return a},initStack:function(){this.map.getCenter()&&this.listeners.moveend()},deactivate:function(){var a=!1;if(this.map&&OpenLayers.Control.prototype.deactivate.apply(this)){for(var b in this.listeners)this.map.events.unregister(b,this,this.listeners[b]);this.clearOnDeactivate&&this.clear();a=!0}return a},CLASS_NAME:"OpenLayers.Control.NavigationHistory"});OpenLayers.Protocol.HTTP=OpenLayers.Class(OpenLayers.Protocol,{url:null,headers:null,params:null,callback:null,scope:null,readWithPOST:!1,updateWithPOST:!1,deleteWithPOST:!1,wildcarded:!1,srsInBBOX:!1,initialize:function(a){a=a||{};this.params={};this.headers={};OpenLayers.Protocol.prototype.initialize.apply(this,arguments);if(!this.filterToParams&&OpenLayers.Format.QueryStringFilter){var b=new OpenLayers.Format.QueryStringFilter({wildcarded:this.wildcarded,srsInBBOX:this.srsInBBOX});this.filterToParams=function(a,d){return b.write(a,d)}}},destroy:function(){this.headers=this.params=null;OpenLayers.Protocol.prototype.destroy.apply(this)},read:function(a){OpenLayers.Protocol.prototype.read.apply(this,arguments);a=a||{};a.params=OpenLayers.Util.applyDefaults(a.params,this.options.params);a=OpenLayers.Util.applyDefaults(a,this.options);a.filter&&this.filterToParams&&(a.params=this.filterToParams(a.filter,a.params));var b=void 0!==a.readWithPOST?a.readWithPOST:this.readWithPOST,c=new OpenLayers.Protocol.Response({requestType:"read"});b?(b=a.headers||{},b["Content-Type"]="application/x-www-form-urlencoded",c.priv=OpenLayers.Request.POST({url:a.url,callback:this.createCallback(this.handleRead,c,a),data:OpenLayers.Util.getParameterString(a.params),headers:b})):c.priv=OpenLayers.Request.GET({url:a.url,callback:this.createCallback(this.handleRead,c,a),params:a.params,headers:a.headers});return c},handleRead:function(a,b){this.handleResponse(a,b)},create:function(a,b){var b=OpenLayers.Util.applyDefaults(b,this.options),c=new OpenLayers.Protocol.Response({reqFeatures:a,requestType:"create"});c.priv=OpenLayers.Request.POST({url:b.url,callback:this.createCallback(this.handleCreate,c,b),headers:b.headers,data:this.format.write(a)});return c},handleCreate:function(a,b){this.handleResponse(a,b)},update:function(a,b){var b=b||{},c=b.url||a.url||this.options.url+"/"+a.fid,b=OpenLayers.Util.applyDefaults(b,this.options),d=new OpenLayers.Protocol.Response({reqFeatures:a,requestType:"update"});d.priv=OpenLayers.Request[this.updateWithPOST?"POST":"PUT"]({url:c,callback:this.createCallback(this.handleUpdate,d,b),headers:b.headers,data:this.format.write(a)});return d},handleUpdate:function(a,b){this.handleResponse(a,b)},"delete":function(a,b){var b=b||{},c=b.url||a.url||this.options.url+"/"+a.fid,b=OpenLayers.Util.applyDefaults(b,this.options),d=new OpenLayers.Protocol.Response({reqFeatures:a,requestType:"delete"}),e=this.deleteWithPOST?"POST":"DELETE",c={url:c,callback:this.createCallback(this.handleDelete,d,b),headers:b.headers};this.deleteWithPOST&&(c.data=this.format.write(a));d.priv=OpenLayers.Request[e](c);return d},handleDelete:function(a,b){this.handleResponse(a,b)},handleResponse:function(a,b){var c=a.priv;b.callback&&(200<=c.status&&300>c.status?("delete"!=a.requestType&&(a.features=this.parseFeatures(c)),a.code=OpenLayers.Protocol.Response.SUCCESS):a.code=OpenLayers.Protocol.Response.FAILURE,b.callback.call(b.scope,a))},parseFeatures:function(a){var b=a.responseXML;if(!b||!b.documentElement)b=a.responseText;return!b||0>=b.length?null:this.format.read(b)},commit:function(a,b){function c(a){for(var b=a.features?a.features.length:0,c=Array(b),e=0;e<b;++e)c[e]=a.features[e].fid;o.insertIds=c;d.apply(this,[a])}function d(a){this.callUserCallback(a,b);n=n&&a.success();f++;f>=m&&b.callback&&(o.code=n?OpenLayers.Protocol.Response.SUCCESS:OpenLayers.Protocol.Response.FAILURE,b.callback.apply(b.scope,[o]))}var b=OpenLayers.Util.applyDefaults(b,this.options),e=[],f=0,g={};g[OpenLayers.State.INSERT]=[];g[OpenLayers.State.UPDATE]=[];g[OpenLayers.State.DELETE]=[];for(var h,i,j=[],k=0,l=a.length;k<l;++k)if(h=a[k],i=g[h.state])i.push(h),j.push(h);var m=(0<g[OpenLayers.State.INSERT].length?1:0)+g[OpenLayers.State.UPDATE].length+g[OpenLayers.State.DELETE].length,n=!0,o=new OpenLayers.Protocol.Response({reqFeatures:j});h=g[OpenLayers.State.INSERT];0<h.length&&e.push(this.create(h,OpenLayers.Util.applyDefaults({callback:c,scope:this},b.create)));h=g[OpenLayers.State.UPDATE];for(k=h.length-1;0<=k;--k)e.push(this.update(h[k],OpenLayers.Util.applyDefaults({callback:d,scope:this},b.update)));h=g[OpenLayers.State.DELETE];for(k=h.length-1;0<=k;--k)e.push(this["delete"](h[k],OpenLayers.Util.applyDefaults({callback:d,scope:this},b["delete"])));return e},abort:function(a){a&&a.priv.abort()},callUserCallback:function(a,b){var c=b[a.requestType];c&&c.callback&&c.callback.call(c.scope,a)},CLASS_NAME:"OpenLayers.Protocol.HTTP"});OpenLayers.Strategy.Cluster=OpenLayers.Class(OpenLayers.Strategy,{distance:20,threshold:null,features:null,clusters:null,clustering:!1,resolution:null,activate:function(){var a=OpenLayers.Strategy.prototype.activate.call(this);if(a)this.layer.events.on({beforefeaturesadded:this.cacheFeatures,moveend:this.cluster,scope:this});return a},deactivate:function(){var a=OpenLayers.Strategy.prototype.deactivate.call(this);a&&(this.clearCache(),this.layer.events.un({beforefeaturesadded:this.cacheFeatures,moveend:this.cluster,scope:this}));return a},cacheFeatures:function(a){var b=!0;this.clustering||(this.clearCache(),this.features=a.features,this.cluster(),b=!1);return b},clearCache:function(){this.features=null},cluster:function(a){if((!a||a.zoomChanged)&&this.features)if(a=this.layer.map.getResolution(),a!=this.resolution||!this.clustersExist()){this.resolution=a;for(var a=[],b,c,d,e=0;e<this.features.length;++e)if(b=this.features[e],b.geometry){c=!1;for(var f=a.length-1;0<=f;--f)if(d=a[f],this.shouldCluster(d,b)){this.addToCluster(d,b);c=!0;break}c||a.push(this.createCluster(this.features[e]))}this.layer.removeAllFeatures();if(0<a.length){if(1<this.threshold){b=a.slice();a=[];e=0;for(d=b.length;e<d;++e)c=b[e],c.attributes.count<this.threshold?Array.prototype.push.apply(a,c.cluster):a.push(c)}this.clustering=!0;this.layer.addFeatures(a);this.clustering=!1}this.clusters=a}},clustersExist:function(){var a=!1;if(this.clusters&&0<this.clusters.length&&this.clusters.length==this.layer.features.length)for(var a=!0,b=0;b<this.clusters.length;++b)if(this.clusters[b]!=this.layer.features[b]){a=!1;break}return a},shouldCluster:function(a,b){var c=a.geometry.getBounds().getCenterLonLat(),d=b.geometry.getBounds().getCenterLonLat();return Math.sqrt(Math.pow(c.lon-d.lon,2)+Math.pow(c.lat-d.lat,2))/this.resolution<=this.distance},addToCluster:function(a,b){a.cluster.push(b);a.attributes.count+=1},createCluster:function(a){var b=a.geometry.getBounds().getCenterLonLat(),b=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(b.lon,b.lat),{count:1});b.cluster=[a];return b},CLASS_NAME:"OpenLayers.Strategy.Cluster"});OpenLayers.Strategy.Filter=OpenLayers.Class(OpenLayers.Strategy,{filter:null,cache:null,caching:!1,activate:function(){var a=OpenLayers.Strategy.prototype.activate.apply(this,arguments);a&&(this.cache=[],this.layer.events.on({beforefeaturesadded:this.handleAdd,beforefeaturesremoved:this.handleRemove,scope:this}));return a},deactivate:function(){this.cache=null;this.layer&&this.layer.events&&this.layer.events.un({beforefeaturesadded:this.handleAdd,beforefeaturesremoved:this.handleRemove,scope:this});return OpenLayers.Strategy.prototype.deactivate.apply(this,arguments)},handleAdd:function(a){if(!this.caching&&this.filter){var b=a.features;a.features=[];for(var c,d=0,e=b.length;d<e;++d)c=b[d],this.filter.evaluate(c)?a.features.push(c):this.cache.push(c)}},handleRemove:function(){this.caching||(this.cache=[])},setFilter:function(a){this.filter=a;a=this.cache;this.cache=[];this.handleAdd({features:this.layer.features});0<this.cache.length&&(this.caching=!0,this.layer.removeFeatures(this.cache.slice()),this.caching=!1);0<a.length&&(a={features:a},this.handleAdd(a),0<a.features.length&&(this.caching=!0,this.layer.addFeatures(a.features),this.caching=!1))},CLASS_NAME:"OpenLayers.Strategy.Filter"});OpenLayers.Protocol.SOS=function(a){var a=OpenLayers.Util.applyDefaults(a,OpenLayers.Protocol.SOS.DEFAULTS),b=OpenLayers.Protocol.SOS["v"+a.version.replace(/\./g,"_")];if(!b)throw"Unsupported SOS version: "+a.version;return new b(a)};OpenLayers.Protocol.SOS.DEFAULTS={version:"1.0.0"};OpenLayers.Format.WFSDescribeFeatureType=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{xsd:"http://www.w3.org/2001/XMLSchema"},readers:{xsd:{schema:function(a,b){var c=[],d={};this.readChildNodes(a,{complexTypes:c,customTypes:d});for(var e=a.attributes,f,g,h=0,i=e.length;h<i;++h)f=e[h],g=f.name,0==g.indexOf("xmlns")?this.setNamespace(g.split(":")[1]||"",f.value):b[g]=f.value;b.featureTypes=c;b.targetPrefix=this.namespaceAlias[b.targetNamespace];h=0;for(i=c.length;h<i;++h)e=c[h],f=d[e.typeName],d[e.typeName]&&(e.typeName=f.name)},complexType:function(a,b){var c={typeName:a.getAttribute("name")};this.readChildNodes(a,c);b.complexTypes.push(c)},complexContent:function(a,b){this.readChildNodes(a,b)},extension:function(a,b){this.readChildNodes(a,b)},sequence:function(a,b){var c={elements:[]};this.readChildNodes(a,c);b.properties=c.elements},element:function(a,b){if(b.elements){for(var c={},d=a.attributes,e,f=0,g=d.length;f<g;++f)e=d[f],c[e.name]=e.value;d=c.type;d||(d={},this.readChildNodes(a,d),c.restriction=d,c.type=d.base);c.localType=(d.base||d).split(":").pop();b.elements.push(c)}b.complexTypes&&(d=a.getAttribute("type"),c=d.split(":").pop(),b.customTypes[c]={name:a.getAttribute("name"),type:d})},simpleType:function(a,b){this.readChildNodes(a,b)},restriction:function(a,b){b.base=a.getAttribute("base");this.readRestriction(a,b)}}},readRestriction:function(a,b){for(var c=a.childNodes,d,e,f=0,g=c.length;f<g;++f)d=c[f],1==d.nodeType&&(e=d.nodeName.split(":").pop(),d=d.getAttribute("value"),b[e]?("string"==typeof b[e]&&(b[e]=[b[e]]),b[e].push(d)):b[e]=d)},read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a&&9==a.nodeType&&(a=a.documentElement);var b={};this.readNode(a,b);return b},CLASS_NAME:"OpenLayers.Format.WFSDescribeFeatureType"});OpenLayers.Format.GeoRSS=OpenLayers.Class(OpenLayers.Format.XML,{rssns:"http://backend.userland.com/rss2",featureNS:"http://mapserver.gis.umn.edu/mapserver",georssns:"http://www.georss.org/georss",geons:"http://www.w3.org/2003/01/geo/wgs84_pos#",featureTitle:"Untitled",featureDescription:"No Description",gmlParser:null,xy:!1,createGeometryFromItem:function(a){var b=this.getElementsByTagNameNS(a,this.georssns,"point"),c=this.getElementsByTagNameNS(a,this.geons,"lat"),d=this.getElementsByTagNameNS(a,this.geons,"long"),e=this.getElementsByTagNameNS(a,this.georssns,"line"),f=this.getElementsByTagNameNS(a,this.georssns,"polygon"),g=this.getElementsByTagNameNS(a,this.georssns,"where"),a=this.getElementsByTagNameNS(a,this.georssns,"box");if(0<b.length||0<c.length&&0<d.length){0<b.length?(c=OpenLayers.String.trim(b[0].firstChild.nodeValue).split(/\s+/),2!=c.length&&(c=OpenLayers.String.trim(b[0].firstChild.nodeValue).split(/\s*,\s*/))):c=[parseFloat(c[0].firstChild.nodeValue),parseFloat(d[0].firstChild.nodeValue)];var h=new OpenLayers.Geometry.Point(c[1],c[0])}else if(0<e.length){c=OpenLayers.String.trim(this.getChildValue(e[0])).split(/\s+/);d=[];e=0;for(f=c.length;e<f;e+=2)b=new OpenLayers.Geometry.Point(c[e+1],c[e]),d.push(b);h=new OpenLayers.Geometry.LineString(d)}else if(0<f.length){c=OpenLayers.String.trim(this.getChildValue(f[0])).split(/\s+/);d=[];e=0;for(f=c.length;e<f;e+=2)b=new OpenLayers.Geometry.Point(c[e+1],c[e]),d.push(b);h=new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing(d)])}else 0<g.length?(this.gmlParser||(this.gmlParser=new OpenLayers.Format.GML({
xy:this.xy})),h=this.gmlParser.parseFeature(g[0]).geometry):0<a.length&&(c=OpenLayers.String.trim(a[0].firstChild.nodeValue).split(/\s+/),d=[],3<c.length&&(b=new OpenLayers.Geometry.Point(c[1],c[0]),d.push(b),b=new OpenLayers.Geometry.Point(c[1],c[2]),d.push(b),b=new OpenLayers.Geometry.Point(c[3],c[2]),d.push(b),b=new OpenLayers.Geometry.Point(c[3],c[0]),d.push(b),b=new OpenLayers.Geometry.Point(c[1],c[0]),d.push(b)),h=new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing(d)]));h&&(this.internalProjection&&this.externalProjection)&&h.transform(this.externalProjection,this.internalProjection);return h},createFeatureFromItem:function(a){var b=this.createGeometryFromItem(a),c=this._getChildValue(a,"*","title",this.featureTitle),d=this._getChildValue(a,"*","description",this._getChildValue(a,"*","content",this._getChildValue(a,"*","summary",this.featureDescription))),e=this._getChildValue(a,"*","link");if(!e)try{e=this.getElementsByTagNameNS(a,"*","link")[0].getAttribute("href")}catch(f){e=null}a=this._getChildValue(a,"*","id",null);b=new OpenLayers.Feature.Vector(b,{title:c,description:d,link:e});b.fid=a;return b},_getChildValue:function(a,b,c,d){return(a=this.getElementsByTagNameNS(a,b,c))&&a[0]&&a[0].firstChild&&a[0].firstChild.nodeValue?this.getChildValue(a[0]):void 0==d?"":d},read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));var b=null,b=this.getElementsByTagNameNS(a,"*","item");0==b.length&&(b=this.getElementsByTagNameNS(a,"*","entry"));for(var a=b.length,c=Array(a),d=0;d<a;d++)c[d]=this.createFeatureFromItem(b[d]);return c},write:function(a){var b;if(OpenLayers.Util.isArray(a)){b=this.createElementNS(this.rssns,"rss");for(var c=0,d=a.length;c<d;c++)b.appendChild(this.createFeatureXML(a[c]))}else b=this.createFeatureXML(a);return OpenLayers.Format.XML.prototype.write.apply(this,[b])},createFeatureXML:function(a){var b=this.buildGeometryNode(a.geometry),c=this.createElementNS(this.rssns,"item"),d=this.createElementNS(this.rssns,"title");d.appendChild(this.createTextNode(a.attributes.title?a.attributes.title:""));var e=this.createElementNS(this.rssns,"description");e.appendChild(this.createTextNode(a.attributes.description?a.attributes.description:""));c.appendChild(d);c.appendChild(e);a.attributes.link&&(d=this.createElementNS(this.rssns,"link"),d.appendChild(this.createTextNode(a.attributes.link)),c.appendChild(d));for(var f in a.attributes)"link"==f||("title"==f||"description"==f)||(d=this.createTextNode(a.attributes[f]),e=f,-1!=f.search(":")&&(e=f.split(":")[1]),e=this.createElementNS(this.featureNS,"feature:"+e),e.appendChild(d),c.appendChild(e));c.appendChild(b);return c},buildGeometryNode:function(a){this.internalProjection&&this.externalProjection&&(a=a.clone(),a.transform(this.internalProjection,this.externalProjection));var b;if("OpenLayers.Geometry.Polygon"==a.CLASS_NAME)b=this.createElementNS(this.georssns,"georss:polygon"),b.appendChild(this.buildCoordinatesNode(a.components[0]));else if("OpenLayers.Geometry.LineString"==a.CLASS_NAME)b=this.createElementNS(this.georssns,"georss:line"),b.appendChild(this.buildCoordinatesNode(a));else if("OpenLayers.Geometry.Point"==a.CLASS_NAME)b=this.createElementNS(this.georssns,"georss:point"),b.appendChild(this.buildCoordinatesNode(a));else throw"Couldn't parse "+a.CLASS_NAME;return b},buildCoordinatesNode:function(a){var b=null;a.components&&(b=a.components);if(b){for(var a=b.length,c=Array(a),d=0;d<a;d++)c[d]=b[d].y+" "+b[d].x;b=c.join(" ")}else b=a.y+" "+a.x;return this.createTextNode(b)},CLASS_NAME:"OpenLayers.Format.GeoRSS"});OpenLayers.Format.WPSCapabilities=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{defaultVersion:"1.0.0",CLASS_NAME:"OpenLayers.Format.WPSCapabilities"});OpenLayers.Format.WPSCapabilities.v1_0_0=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ows:"http://www.opengis.net/ows/1.1",wps:"http://www.opengis.net/wps/1.0.0",xlink:"http://www.w3.org/1999/xlink"},regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a&&9==a.nodeType&&(a=a.documentElement);var b={};this.readNode(a,b);return b},readers:{wps:{Capabilities:function(a,b){this.readChildNodes(a,b)},ProcessOfferings:function(a,b){b.processOfferings={};this.readChildNodes(a,b.processOfferings)},Process:function(a,b){var c={processVersion:this.getAttributeNS(a,this.namespaces.wps,"processVersion")};this.readChildNodes(a,c);b[c.identifier]=c},Languages:function(a,b){b.languages=[];this.readChildNodes(a,b.languages)},Default:function(a,b){var c={isDefault:!0};this.readChildNodes(a,c);b.push(c)},Supported:function(a,b){var c={};this.readChildNodes(a,c);b.push(c)}},ows:OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers.ows},CLASS_NAME:"OpenLayers.Format.WPSCapabilities.v1_0_0"});OpenLayers.Control.PinchZoom=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,containerCenter:null,pinchOrigin:null,currentCenter:null,autoActivate:!0,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.handler=new OpenLayers.Handler.Pinch(this,{start:this.pinchStart,move:this.pinchMove,done:this.pinchDone},this.handlerOptions)},activate:function(){var a=OpenLayers.Control.prototype.activate.apply(this,arguments);a&&(this.map.events.on({moveend:this.updateContainerCenter,scope:this}),this.updateContainerCenter());return a},deactivate:function(){var a=OpenLayers.Control.prototype.deactivate.apply(this,arguments);this.map&&this.map.events&&this.map.events.un({moveend:this.updateContainerCenter,scope:this});return a},updateContainerCenter:function(){var a=this.map.layerContainerDiv;this.containerCenter={x:parseInt(a.style.left,10)+50,y:parseInt(a.style.top,10)+50}},pinchStart:function(a){this.currentCenter=this.pinchOrigin=a.xy},pinchMove:function(a,b){var c=b.scale,d=this.containerCenter,e=this.pinchOrigin,f=a.xy,g=Math.round(f.x-e.x+(c-1)*(d.x-e.x)),d=Math.round(f.y-e.y+(c-1)*(d.y-e.y));this.applyTransform("translate("+g+"px, "+d+"px) scale("+c+")");this.currentCenter=f},applyTransform:function(a){var b=this.map.layerContainerDiv.style;b["-webkit-transform"]=a;b["-moz-transform"]=a},pinchDone:function(a,b,c){this.applyTransform("");a=this.map.getZoomForResolution(this.map.getResolution()/c.scale,!0);if(a!==this.map.getZoom()||!this.currentCenter.equals(this.pinchOrigin)){var b=this.map.getResolutionForZoom(a),c=this.map.getLonLatFromPixel(this.pinchOrigin),d=this.currentCenter,e=this.map.getSize();c.lon+=b*(e.w/2-d.x);c.lat-=b*(e.h/2-d.y);this.map.div.clientWidth=this.map.div.clientWidth;this.map.setCenter(c,a)}},CLASS_NAME:"OpenLayers.Control.PinchZoom"});OpenLayers.Control.TouchNavigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,pinchZoom:null,pinchZoomOptions:null,clickHandlerOptions:null,documentDrag:!1,autoActivate:!0,initialize:function(a){this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.deactivate();this.dragPan&&this.dragPan.destroy();this.dragPan=null;this.pinchZoom&&(this.pinchZoom.destroy(),delete this.pinchZoom);OpenLayers.Control.prototype.destroy.apply(this,arguments)},activate:function(){return OpenLayers.Control.prototype.activate.apply(this,arguments)?(this.dragPan.activate(),this.handlers.click.activate(),this.pinchZoom.activate(),!0):!1},deactivate:function(){return OpenLayers.Control.prototype.deactivate.apply(this,arguments)?(this.dragPan.deactivate(),this.handlers.click.deactivate(),this.pinchZoom.deactivate(),!0):!1},draw:function(){var a={click:this.defaultClick,dblclick:this.defaultDblClick},b=OpenLayers.Util.extend({"double":!0,stopDouble:!0,pixelTolerance:2},this.clickHandlerOptions);this.handlers.click=new OpenLayers.Handler.Click(this,a,b);this.dragPan=new OpenLayers.Control.DragPan(OpenLayers.Util.extend({map:this.map,documentDrag:this.documentDrag},this.dragPanOptions));this.dragPan.draw();this.pinchZoom=new OpenLayers.Control.PinchZoom(OpenLayers.Util.extend({map:this.map},this.pinchZoomOptions))},defaultClick:function(a){a.lastTouches&&2==a.lastTouches.length&&this.map.zoomOut()},defaultDblClick:function(a){this.map.setCenter(this.map.getLonLatFromViewPortPx(a.xy),this.map.zoom+1)},CLASS_NAME:"OpenLayers.Control.TouchNavigation"});OpenLayers.Style2=OpenLayers.Class({id:null,name:null,title:null,description:null,layerName:null,isDefault:!1,rules:null,initialize:function(a){OpenLayers.Util.extend(this,a);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){for(var a=0,b=this.rules.length;a<b;a++)this.rules[a].destroy();delete this.rules},clone:function(){var a=OpenLayers.Util.extend({},this);if(this.rules){a.rules=[];for(var b=0,c=this.rules.length;b<c;++b)a.rules.push(this.rules[b].clone())}return new OpenLayers.Style2(a)},CLASS_NAME:"OpenLayers.Style2"});OpenLayers.Format.WFS=OpenLayers.Class(OpenLayers.Format.GML,{layer:null,wfsns:"http://www.opengis.net/wfs",ogcns:"http://www.opengis.net/ogc",initialize:function(a,b){OpenLayers.Format.GML.prototype.initialize.apply(this,[a]);this.layer=b;this.layer.featureNS&&(this.featureNS=this.layer.featureNS);this.layer.options.geometry_column&&(this.geometryName=this.layer.options.geometry_column);this.layer.options.typename&&(this.featureName=this.layer.options.typename)},write:function(a){var b=this.createElementNS(this.wfsns,"wfs:Transaction");b.setAttribute("version","1.0.0");b.setAttribute("service","WFS");for(var c=0;c<a.length;c++)switch(a[c].state){case OpenLayers.State.INSERT:b.appendChild(this.insert(a[c]));break;case OpenLayers.State.UPDATE:b.appendChild(this.update(a[c]));break;case OpenLayers.State.DELETE:b.appendChild(this.remove(a[c]))}return OpenLayers.Format.XML.prototype.write.apply(this,[b])},createFeatureXML:function(a){var b=this.buildGeometryNode(a.geometry),c=this.createElementNS(this.featureNS,"feature:"+this.geometryName);c.appendChild(b);b=this.createElementNS(this.featureNS,"feature:"+this.featureName);b.appendChild(c);for(var d in a.attributes){var c=this.createTextNode(a.attributes[d]),e=d;-1!=d.search(":")&&(e=d.split(":")[1]);e=this.createElementNS(this.featureNS,"feature:"+e);e.appendChild(c);b.appendChild(e)}return b},insert:function(a){var b=this.createElementNS(this.wfsns,"wfs:Insert");b.appendChild(this.createFeatureXML(a));return b},update:function(a){a.fid||OpenLayers.Console.userError(OpenLayers.i18n("noFID"));var b=this.createElementNS(this.wfsns,"wfs:Update");b.setAttribute("typeName",this.featurePrefix+":"+this.featureName);b.setAttribute("xmlns:"+this.featurePrefix,this.featureNS);var c=this.createElementNS(this.wfsns,"wfs:Property"),d=this.createElementNS(this.wfsns,"wfs:Name"),e=this.createTextNode(this.geometryName);d.appendChild(e);c.appendChild(d);d=this.createElementNS(this.wfsns,"wfs:Value");e=this.buildGeometryNode(a.geometry);a.layer&&e.setAttribute("srsName",a.layer.projection.getCode());d.appendChild(e);c.appendChild(d);b.appendChild(c);for(var f in a.attributes)c=this.createElementNS(this.wfsns,"wfs:Property"),d=this.createElementNS(this.wfsns,"wfs:Name"),d.appendChild(this.createTextNode(f)),c.appendChild(d),d=this.createElementNS(this.wfsns,"wfs:Value"),d.appendChild(this.createTextNode(a.attributes[f])),c.appendChild(d),b.appendChild(c);c=this.createElementNS(this.ogcns,"ogc:Filter");f=this.createElementNS(this.ogcns,"ogc:FeatureId");f.setAttribute("fid",a.fid);c.appendChild(f);b.appendChild(c);return b},remove:function(a){if(!a.fid)return OpenLayers.Console.userError(OpenLayers.i18n("noFID")),!1;var b=this.createElementNS(this.wfsns,"wfs:Delete");b.setAttribute("typeName",this.featurePrefix+":"+this.featureName);b.setAttribute("xmlns:"+this.featurePrefix,this.featureNS);var c=this.createElementNS(this.ogcns,"ogc:Filter"),d=this.createElementNS(this.ogcns,"ogc:FeatureId");d.setAttribute("fid",a.fid);c.appendChild(d);b.appendChild(c);return b},destroy:function(){this.layer=null},CLASS_NAME:"OpenLayers.Format.WFS"});OpenLayers.Format.SLD.v1_0_0_GeoServer=OpenLayers.Class(OpenLayers.Format.SLD.v1_0_0,{version:"1.0.0",profile:"GeoServer",readers:OpenLayers.Util.applyDefaults({sld:OpenLayers.Util.applyDefaults({Priority:function(a,b){var c=this.readers.ogc._expression.call(this,a);c&&(b.priority=c)},VendorOption:function(a,b){b.vendorOptions||(b.vendorOptions={});b.vendorOptions[a.getAttribute("name")]=this.getChildValue(a)}},OpenLayers.Format.SLD.v1_0_0.prototype.readers.sld)},OpenLayers.Format.SLD.v1_0_0.prototype.readers),writers:OpenLayers.Util.applyDefaults({sld:OpenLayers.Util.applyDefaults({Priority:function(a){return this.writers.sld._OGCExpression.call(this,"sld:Priority",a)},VendorOption:function(a){return this.createElementNSPlus("sld:VendorOption",{attributes:{name:a.name},value:a.value})},TextSymbolizer:function(a){var b=OpenLayers.Format.SLD.v1_0_0.prototype.writers.sld.TextSymbolizer.apply(this,arguments);!1!==a.graphic&&(a.externalGraphic||a.graphicName)&&this.writeNode("Graphic",a,b);"priority"in a&&this.writeNode("Priority",a.priority,b);return this.addVendorOptions(b,a)},PointSymbolizer:function(a){return this.addVendorOptions(OpenLayers.Format.SLD.v1_0_0.prototype.writers.sld.PointSymbolizer.apply(this,arguments),a)},LineSymbolizer:function(a){return this.addVendorOptions(OpenLayers.Format.SLD.v1_0_0.prototype.writers.sld.LineSymbolizer.apply(this,arguments),a)},PolygonSymbolizer:function(a){return this.addVendorOptions(OpenLayers.Format.SLD.v1_0_0.prototype.writers.sld.PolygonSymbolizer.apply(this,arguments),a)}},OpenLayers.Format.SLD.v1_0_0.prototype.writers.sld)},OpenLayers.Format.SLD.v1_0_0.prototype.writers),addVendorOptions:function(a,b){if(b.vendorOptions)for(var c in b.vendorOptions)this.writeNode("VendorOption",{name:c,value:b.vendorOptions[c]},a);return a},CLASS_NAME:"OpenLayers.Format.SLD.v1_0_0_GeoServer"});OpenLayers.Layer.Boxes=OpenLayers.Class(OpenLayers.Layer.Markers,{drawMarker:function(a){var b=this.map.getLayerPxFromLonLat({lon:a.bounds.left,lat:a.bounds.top}),c=this.map.getLayerPxFromLonLat({lon:a.bounds.right,lat:a.bounds.bottom});null==c||null==b?a.display(!1):(b=a.draw(b,{w:Math.max(1,c.x-b.x),h:Math.max(1,c.y-b.y)}),a.drawn||(this.div.appendChild(b),a.drawn=!0))},removeMarker:function(a){OpenLayers.Util.removeItem(this.markers,a);null!=a.div&&a.div.parentNode==this.div&&this.div.removeChild(a.div)},CLASS_NAME:"OpenLayers.Layer.Boxes"});OpenLayers.Format.WFSCapabilities.v1_0_0=OpenLayers.Class(OpenLayers.Format.WFSCapabilities.v1,{readers:{wfs:OpenLayers.Util.applyDefaults({Service:function(a,b){b.service={};this.readChildNodes(a,b.service)},Fees:function(a,b){var c=this.getChildValue(a);c&&"none"!=c.toLowerCase()&&(b.fees=c)},AccessConstraints:function(a,b){var c=this.getChildValue(a);c&&"none"!=c.toLowerCase()&&(b.accessConstraints=c)},OnlineResource:function(a,b){var c=this.getChildValue(a);c&&"none"!=c.toLowerCase()&&(b.onlineResource=c)},Keywords:function(a,b){var c=this.getChildValue(a);c&&"none"!=c.toLowerCase()&&(b.keywords=c.split(", "))},Capability:function(a,b){b.capability={};this.readChildNodes(a,b.capability)},Request:function(a,b){b.request={};this.readChildNodes(a,b.request)},GetFeature:function(a,b){b.getfeature={href:{},formats:[]};this.readChildNodes(a,b.getfeature)},ResultFormat:function(a,b){for(var c=a.childNodes,d,e=0;e<c.length;e++)d=c[e],1==d.nodeType&&b.formats.push(d.nodeName)},DCPType:function(a,b){this.readChildNodes(a,b)},HTTP:function(a,b){this.readChildNodes(a,b.href)},Get:function(a,b){b.get=a.getAttribute("onlineResource")},Post:function(a,b){b.post=a.getAttribute("onlineResource")},SRS:function(a,b){var c=this.getChildValue(a);c&&(b.srs=c)}},OpenLayers.Format.WFSCapabilities.v1.prototype.readers.wfs)},CLASS_NAME:"OpenLayers.Format.WFSCapabilities.v1_0_0"});OpenLayers.Format.WMSCapabilities=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{defaultVersion:"1.1.1",profile:null,CLASS_NAME:"OpenLayers.Format.WMSCapabilities"});OpenLayers.Format.WMSCapabilities.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{wms:"http://www.opengis.net/wms",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},defaultPrefix:"wms",read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));var b=a;a&&9==a.nodeType&&(a=a.documentElement);var c={};this.readNode(a,c);void 0===c.service&&(a=new OpenLayers.Format.OGCExceptionReport,c.error=a.read(b));return c},readers:{wms:{Service:function(a,b){b.service={};this.readChildNodes(a,b.service)},Name:function(a,b){b.name=this.getChildValue(a)},Title:function(a,b){b.title=this.getChildValue(a)},Abstract:function(a,b){b["abstract"]=this.getChildValue(a)},BoundingBox:function(a){var b={};b.bbox=[parseFloat(a.getAttribute("minx")),parseFloat(a.getAttribute("miny")),parseFloat(a.getAttribute("maxx")),parseFloat(a.getAttribute("maxy"))];a={x:parseFloat(a.getAttribute("resx")),y:parseFloat(a.getAttribute("resy"))};if(!isNaN(a.x)||!isNaN(a.y))b.res=a;return b},OnlineResource:function(a,b){b.href=this.getAttributeNS(a,this.namespaces.xlink,"href")},ContactInformation:function(a,b){b.contactInformation={};this.readChildNodes(a,b.contactInformation)},ContactPersonPrimary:function(a,b){b.personPrimary={};this.readChildNodes(a,b.personPrimary)},ContactPerson:function(a,b){b.person=this.getChildValue(a)},ContactOrganization:function(a,b){b.organization=this.getChildValue(a)},ContactPosition:function(a,b){b.position=this.getChildValue(a)},ContactAddress:function(a,b){b.contactAddress={};this.readChildNodes(a,b.contactAddress)},AddressType:function(a,b){b.type=this.getChildValue(a)},Address:function(a,b){b.address=this.getChildValue(a)},City:function(a,b){b.city=this.getChildValue(a)},StateOrProvince:function(a,b){b.stateOrProvince=this.getChildValue(a)},PostCode:function(a,b){b.postcode=this.getChildValue(a)},Country:function(a,b){b.country=this.getChildValue(a)},ContactVoiceTelephone:function(a,b){b.phone=this.getChildValue(a)},ContactFacsimileTelephone:function(a,b){b.fax=this.getChildValue(a)},ContactElectronicMailAddress:function(a,b){b.email=this.getChildValue(a)},Fees:function(a,b){var c=this.getChildValue(a);c&&"none"!=c.toLowerCase()&&(b.fees=c)},AccessConstraints:function(a,b){var c=this.getChildValue(a);c&&"none"!=c.toLowerCase()&&(b.accessConstraints=c)},Capability:function(a,b){b.capability={nestedLayers:[],layers:[]};this.readChildNodes(a,b.capability)},Request:function(a,b){b.request={};this.readChildNodes(a,b.request)},GetCapabilities:function(a,b){b.getcapabilities={formats:[]};this.readChildNodes(a,b.getcapabilities)},Format:function(a,b){OpenLayers.Util.isArray(b.formats)?b.formats.push(this.getChildValue(a)):b.format=this.getChildValue(a)},DCPType:function(a,b){this.readChildNodes(a,b)},HTTP:function(a,b){this.readChildNodes(a,b)},Get:function(a,b){b.get={};this.readChildNodes(a,b.get);b.href||(b.href=b.get.href)},Post:function(a,b){b.post={};this.readChildNodes(a,b.post);b.href||(b.href=b.get.href)},GetMap:function(a,b){b.getmap={formats:[]};this.readChildNodes(a,b.getmap)},GetFeatureInfo:function(a,b){b.getfeatureinfo={formats:[]};this.readChildNodes(a,b.getfeatureinfo)},Exception:function(a,b){b.exception={formats:[]};this.readChildNodes(a,b.exception)},Layer:function(a,b){var c,d;b.capability?(d=b.capability,c=b):d=b;var e=a.getAttributeNode("queryable"),f=e&&e.specified?a.getAttribute("queryable"):null,g=(e=a.getAttributeNode("cascaded"))&&e.specified?a.getAttribute("cascaded"):null,e=(e=a.getAttributeNode("opaque"))&&e.specified?a.getAttribute("opaque"):null,h=a.getAttribute("noSubsets"),i=a.getAttribute("fixedWidth"),j=a.getAttribute("fixedHeight"),k=c||{},l=OpenLayers.Util.extend;c={nestedLayers:[],styles:c?[].concat(c.styles):[],srs:c?l({},k.srs):{},metadataURLs:[],bbox:c?l({},k.bbox):{},llbbox:k.llbbox,dimensions:c?l({},k.dimensions):{},authorityURLs:c?l({},k.authorityURLs):{},identifiers:{},keywords:[],queryable:f&&""!==f?"1"===f||"true"===f:k.queryable||!1,cascaded:null!==g?parseInt(g):k.cascaded||0,opaque:e?"1"===e||"true"===e:k.opaque||!1,noSubsets:null!==h?"1"===h||"true"===h:k.noSubsets||!1,fixedWidth:null!=i?parseInt(i):k.fixedWidth||0,fixedHeight:null!=j?parseInt(j):k.fixedHeight||0,minScale:k.minScale,maxScale:k.maxScale,attribution:k.attribution};b.nestedLayers.push(c);c.capability=d;this.readChildNodes(a,c);delete c.capability;if(c.name&&(f=c.name.split(":"),g=d.request,e=g.getfeatureinfo,0<f.length&&(c.prefix=f[0]),d.layers.push(c),void 0===c.formats&&(c.formats=g.getmap.formats),void 0===c.infoFormats&&e))c.infoFormats=e.formats},Attribution:function(a,b){b.attribution={};this.readChildNodes(a,b.attribution)},LogoURL:function(a,b){b.logo={width:a.getAttribute("width"),height:a.getAttribute("height")};this.readChildNodes(a,b.logo)},Style:function(a,b){var c={};b.styles.push(c);this.readChildNodes(a,c)},LegendURL:function(a,b){var c={width:a.getAttribute("width"),height:a.getAttribute("height")};b.legend=c;this.readChildNodes(a,c)},MetadataURL:function(a,b){var c={type:a.getAttribute("type")};b.metadataURLs.push(c);this.readChildNodes(a,c)},DataURL:function(a,b){b.dataURL={};this.readChildNodes(a,b.dataURL)},FeatureListURL:function(a,b){b.featureListURL={};this.readChildNodes(a,b.featureListURL)},AuthorityURL:function(a,b){var c=a.getAttribute("name"),d={};this.readChildNodes(a,d);b.authorityURLs[c]=d.href},Identifier:function(a,b){var c=a.getAttribute("authority");b.identifiers[c]=this.getChildValue(a)},KeywordList:function(a,b){this.readChildNodes(a,b)},SRS:function(a,b){b.srs[this.getChildValue(a)]=!0}}},CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1"});OpenLayers.Format.WMSCapabilities.v1_3=OpenLayers.Class(OpenLayers.Format.WMSCapabilities.v1,{readers:{wms:OpenLayers.Util.applyDefaults({WMS_Capabilities:function(a,b){this.readChildNodes(a,b)},LayerLimit:function(a,b){b.layerLimit=parseInt(this.getChildValue(a))},MaxWidth:function(a,b){b.maxWidth=parseInt(this.getChildValue(a))},MaxHeight:function(a,b){b.maxHeight=parseInt(this.getChildValue(a))},BoundingBox:function(a,b){var c=OpenLayers.Format.WMSCapabilities.v1.prototype.readers.wms.BoundingBox.apply(this,[a,b]);c.srs=a.getAttribute("CRS");b.bbox[c.srs]=c},CRS:function(a,b){this.readers.wms.SRS.apply(this,[a,b])},EX_GeographicBoundingBox:function(a,b){b.llbbox=[];this.readChildNodes(a,b.llbbox)},westBoundLongitude:function(a,b){b[0]=this.getChildValue(a)},eastBoundLongitude:function(a,b){b[2]=this.getChildValue(a)},southBoundLatitude:function(a,b){b[1]=this.getChildValue(a)},northBoundLatitude:function(a,b){b[3]=this.getChildValue(a)},MinScaleDenominator:function(a,b){b.maxScale=parseFloat(this.getChildValue(a)).toPrecision(16)},MaxScaleDenominator:function(a,b){b.minScale=parseFloat(this.getChildValue(a)).toPrecision(16)},Dimension:function(a,b){var c={name:a.getAttribute("name").toLowerCase(),units:a.getAttribute("units"),unitsymbol:a.getAttribute("unitSymbol"),nearestVal:"1"===a.getAttribute("nearestValue"),multipleVal:"1"===a.getAttribute("multipleValues"),"default":a.getAttribute("default")||"",current:"1"===a.getAttribute("current"),values:this.getChildValue(a).split(",")};b.dimensions[c.name]=c},Keyword:function(a,b){var c={value:this.getChildValue(a),vocabulary:a.getAttribute("vocabulary")};b.keywords&&b.keywords.push(c)}},OpenLayers.Format.WMSCapabilities.v1.prototype.readers.wms),sld:{UserDefinedSymbolization:function(a,b){this.readers.wms.UserDefinedSymbolization.apply(this,[a,b]);b.userSymbols.inlineFeature=1==parseInt(a.getAttribute("InlineFeature"));b.userSymbols.remoteWCS=1==parseInt(a.getAttribute("RemoteWCS"))},DescribeLayer:function(a,b){this.readers.wms.DescribeLayer.apply(this,[a,b])},GetLegendGraphic:function(a,b){this.readers.wms.GetLegendGraphic.apply(this,[a,b])}}},CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1_3"});OpenLayers.Layer.Zoomify=OpenLayers.Class(OpenLayers.Layer.Grid,{size:null,isBaseLayer:!0,standardTileSize:256,tileOriginCorner:"tl",numberOfTiers:0,tileCountUpToTier:null,tierSizeInTiles:null,tierImageSize:null,initialize:function(a,b,c,d){this.initializeZoomify(c);OpenLayers.Layer.Grid.prototype.initialize.apply(this,[a,b,c,{},d])},initializeZoomify:function(a){var a=a.clone(),b=new OpenLayers.Size(Math.ceil(a.w/this.standardTileSize),Math.ceil(a.h/this.standardTileSize));this.tierSizeInTiles=[b];for(this.tierImageSize=[a];a.w>this.standardTileSize||a.h>this.standardTileSize;)a=new OpenLayers.Size(Math.floor(a.w/2),Math.floor(a.h/2)),b=new OpenLayers.Size(Math.ceil(a.w/this.standardTileSize),Math.ceil(a.h/this.standardTileSize)),this.tierSizeInTiles.push(b),this.tierImageSize.push(a);this.tierSizeInTiles.reverse();this.tierImageSize.reverse();this.numberOfTiers=this.tierSizeInTiles.length;this.tileCountUpToTier=[0];for(a=1;a<this.numberOfTiers;a++)this.tileCountUpToTier.push(this.tierSizeInTiles[a-1].w*this.tierSizeInTiles[a-1].h+this.tileCountUpToTier[a-1])},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments);this.tileCountUpToTier.length=0;this.tierSizeInTiles.length=0;this.tierImageSize.length=0},clone:function(a){null==a&&(a=new OpenLayers.Layer.Zoomify(this.name,this.url,this.size,this.options));return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a])},getURL:function(a){var a=this.adjustBounds(a),b=this.map.getResolution(),c=Math.round((a.left-this.tileOrigin.lon)/(b*this.tileSize.w)),a=Math.round((this.tileOrigin.lat-a.top)/(b*this.tileSize.h)),b=this.map.getZoom(),c="TileGroup"+Math.floor((c+a*this.tierSizeInTiles[b].w+this.tileCountUpToTier[b])/256)+"/"+b+"-"+c+"-"+a+".jpg",a=this.url;OpenLayers.Util.isArray(a)&&(a=this.selectUrl(c,a));return a+c},getImageSize:function(){if(0<arguments.length){var a=this.adjustBounds(arguments[0]),b=this.map.getResolution(),c=Math.round((a.left-this.tileOrigin.lon)/(b*this.tileSize.w)),a=Math.round((this.tileOrigin.lat-a.top)/(b*this.tileSize.h)),b=this.map.getZoom(),d=this.standardTileSize,e=this.standardTileSize;c==this.tierSizeInTiles[b].w-1&&(d=this.tierImageSize[b].w%this.standardTileSize);a==this.tierSizeInTiles[b].h-1&&(e=this.tierImageSize[b].h%this.standardTileSize);return new OpenLayers.Size(d,e)}return this.tileSize},setMap:function(a){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);this.tileOrigin=new OpenLayers.LonLat(this.map.maxExtent.left,this.map.maxExtent.top)},calculateGridLayout:function(a,b,c){var d=c*this.tileSize.w,c=c*this.tileSize.h,e=a.left-b.lon,f=Math.floor(e/d)-this.buffer,a=b.lat-a.top+c,g=Math.floor(a/c)-this.buffer;return{tilelon:d,tilelat:c,tileoffsetlon:b.lon+f*d,tileoffsetlat:b.lat-c*g,tileoffsetx:-(e/d-f)*this.tileSize.w,tileoffsety:(g-a/c)*this.tileSize.h}},CLASS_NAME:"OpenLayers.Layer.Zoomify"});OpenLayers.Layer.MapServer=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{mode:"map",map_imagetype:"png"},initialize:function(a,b,c,d){OpenLayers.Layer.Grid.prototype.initialize.apply(this,arguments);this.params=OpenLayers.Util.applyDefaults(this.params,this.DEFAULT_PARAMS);if(null==d||null==d.isBaseLayer)this.isBaseLayer="true"!=this.params.transparent&&!0!=this.params.transparent},clone:function(a){null==a&&(a=new OpenLayers.Layer.MapServer(this.name,this.url,this.params,this.getOptions()));return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a])},getURL:function(a){var a=this.adjustBounds(a),a=[a.left,a.bottom,a.right,a.top],b=this.getImageSize();return this.getFullRequestString({mapext:a,imgext:a,map_size:[b.w,b.h],imgx:b.w/2,imgy:b.h/2,imgxy:[b.w,b.h]})},getFullRequestString:function(a,b){var c=null==b?this.url:b,d=OpenLayers.Util.extend({},this.params),d=OpenLayers.Util.extend(d,a),e=OpenLayers.Util.getParameterString(d);OpenLayers.Util.isArray(c)&&(c=this.selectUrl(e,c));var e=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(c)),f;for(f in d)f.toUpperCase()in e&&delete d[f];e=OpenLayers.Util.getParameterString(d);d=c;e=e.replace(/,/g,"+");""!=e&&(f=c.charAt(c.length-1),d="&"==f||"?"==f?d+e:-1==c.indexOf("?")?d+("?"+e):d+("&"+e));return d},CLASS_NAME:"OpenLayers.Layer.MapServer"});OpenLayers.Renderer.VML=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"urn:schemas-microsoft-com:vml",symbolCache:{},offset:null,initialize:function(a){if(this.supported()){if(!document.namespaces.olv){document.namespaces.add("olv",this.xmlns);for(var b=document.createStyleSheet(),c="shape rect oval fill stroke imagedata group textbox".split(" "),d=0,e=c.length;d<e;d++)b.addRule("olv\\:"+c[d],"behavior: url(#default#VML); position: absolute; display: inline-block;")}OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments)}},supported:function(){return!!document.namespaces},setExtent:function(a,b){var c=OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments),d=this.getResolution(),e=a.left/d|0,d=a.top/d-this.size.h|0;b||!this.offset?(this.offset={x:e,y:d},d=e=0):(e-=this.offset.x,d-=this.offset.y);this.root.coordorigin=e-this.xOffset+" "+d;for(var e=[this.root,this.vectorRoot,this.textRoot],f=0,g=e.length;f<g;++f)d=e[f],d.coordsize=this.size.w+" "+this.size.h;this.root.style.flip="y";return c},setSize:function(a){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);for(var b=[this.rendererRoot,this.root,this.vectorRoot,this.textRoot],c=this.size.w+"px",d=this.size.h+"px",e,f=0,g=b.length;f<g;++f)e=b[f],e.style.width=c,e.style.height=d},getNodeType:function(a,b){var c=null;switch(a.CLASS_NAME){case"OpenLayers.Geometry.Point":c=b.externalGraphic?"olv:rect":this.isComplexSymbol(b.graphicName)?"olv:shape":"olv:oval";break;case"OpenLayers.Geometry.Rectangle":c="olv:rect";break;case"OpenLayers.Geometry.LineString":case"OpenLayers.Geometry.LinearRing":case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":c="olv:shape"}return c},setStyle:function(a,b,c,d){var b=b||a._style,c=c||a._options,e=b.fillColor;if("OpenLayers.Geometry.Point"===a._geometryClass)if(b.externalGraphic){c.isFilled=!0;b.graphicTitle&&(a.title=b.graphicTitle);var e=b.graphicWidth||b.graphicHeight,f=b.graphicHeight||b.graphicWidth,e=e?e:2*b.pointRadius,f=f?f:2*b.pointRadius,g=this.getResolution(),h=void 0!=b.graphicXOffset?b.graphicXOffset:-(.5*e),i=void 0!=b.graphicYOffset?b.graphicYOffset:-(.5*f);a.style.left=((d.x-this.featureDx)/g-this.offset.x+h|0)+"px";a.style.top=(d.y/g-this.offset.y-(i+f)|0)+"px";a.style.width=e+"px";a.style.height=f+"px";a.style.flip="y";e="none";c.isStroked=!1}else this.isComplexSymbol(b.graphicName)?(f=this.importSymbol(b.graphicName),a.path=f.path,a.coordorigin=f.left+","+f.bottom,f=f.size,a.coordsize=f+","+f,this.drawCircle(a,d,b.pointRadius),a.style.flip="y"):this.drawCircle(a,d,b.pointRadius);c.isFilled?a.fillcolor=e:a.filled="false";d=a.getElementsByTagName("fill");d=0==d.length?null:d[0];if(c.isFilled){d||(d=this.createNode("olv:fill",a.id+"_fill"));d.opacity=b.fillOpacity;if("OpenLayers.Geometry.Point"===a._geometryClass&&b.externalGraphic&&(b.graphicOpacity&&(d.opacity=b.graphicOpacity),d.src=b.externalGraphic,d.type="frame",!b.graphicWidth||!b.graphicHeight))d.aspect="atmost";d.parentNode!=a&&a.appendChild(d)}else d&&a.removeChild(d);e=b.rotation;if(void 0!==e||void 0!==a._rotation)a._rotation=e,b.externalGraphic?(this.graphicRotate(a,h,i,b),d.opacity=0):"OpenLayers.Geometry.Point"===a._geometryClass&&(a.style.rotation=e||0);h=a.getElementsByTagName("stroke");h=0==h.length?null:h[0];if(c.isStroked){if(h||(h=this.createNode("olv:stroke",a.id+"_stroke"),a.appendChild(h)),h.on=!0,h.color=b.strokeColor,h.weight=b.strokeWidth+"px",h.opacity=b.strokeOpacity,h.endcap="butt"==b.strokeLinecap?"flat":b.strokeLinecap||"round",b.strokeDashstyle)h.dashstyle=this.dashStyle(b)}else a.stroked=!1,h&&(h.on=!1);"inherit"!=b.cursor&&null!=b.cursor&&(a.style.cursor=b.cursor);return a},graphicRotate:function(a,b,c,d){var d=d||a._style,e=d.rotation||0,f,g;if(!d.graphicWidth||!d.graphicHeight){var h=new Image;h.onreadystatechange=OpenLayers.Function.bind(function(){if("complete"==h.readyState||"interactive"==h.readyState)f=h.width/h.height,
g=Math.max(2*d.pointRadius,d.graphicWidth||0,d.graphicHeight||0),b*=f,d.graphicWidth=g*f,d.graphicHeight=g,this.graphicRotate(a,b,c,d)},this);h.src=d.externalGraphic}else{g=Math.max(d.graphicWidth,d.graphicHeight);f=d.graphicWidth/d.graphicHeight;var i=Math.round(d.graphicWidth||g*f),j=Math.round(d.graphicHeight||g);a.style.width=i+"px";a.style.height=j+"px";var k=document.getElementById(a.id+"_image");k||(k=this.createNode("olv:imagedata",a.id+"_image"),a.appendChild(k));k.style.width=i+"px";k.style.height=j+"px";k.src=d.externalGraphic;k.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='', sizingMethod='scale')";k=e*Math.PI/180;e=Math.sin(k);k=Math.cos(k);e="progid:DXImageTransform.Microsoft.Matrix(M11="+k+",M12="+-e+",M21="+e+",M22="+k+",SizingMethod='auto expand')\n";(k=d.graphicOpacity||d.fillOpacity)&&1!=k&&(e+="progid:DXImageTransform.Microsoft.BasicImage(opacity="+k+")\n");a.style.filter=e;e=new OpenLayers.Geometry.Point(-b,-c);i=new OpenLayers.Bounds(0,0,i,j).toGeometry();i.rotate(d.rotation,e);i=i.getBounds();a.style.left=Math.round(parseInt(a.style.left)+i.left)+"px";a.style.top=Math.round(parseInt(a.style.top)-i.bottom)+"px"}},postDraw:function(a){a.style.visibility="visible";var b=a._style.fillColor,c=a._style.strokeColor;"none"==b&&a.fillcolor!=b&&(a.fillcolor=b);"none"==c&&a.strokecolor!=c&&(a.strokecolor=c)},setNodeDimension:function(a,b){var c=b.getBounds();if(c){var d=this.getResolution(),c=new OpenLayers.Bounds((c.left-this.featureDx)/d-this.offset.x|0,c.bottom/d-this.offset.y|0,(c.right-this.featureDx)/d-this.offset.x|0,c.top/d-this.offset.y|0);a.style.left=c.left+"px";a.style.top=c.top+"px";a.style.width=c.getWidth()+"px";a.style.height=c.getHeight()+"px";a.coordorigin=c.left+" "+c.top;a.coordsize=c.getWidth()+" "+c.getHeight()}},dashStyle:function(a){a=a.strokeDashstyle;switch(a){case"solid":case"dot":case"dash":case"dashdot":case"longdash":case"longdashdot":return a;default:return a=a.split(/[ ,]/),2==a.length?1*a[0]>=2*a[1]?"longdash":1==a[0]||1==a[1]?"dot":"dash":4==a.length?1*a[0]>=2*a[1]?"longdashdot":"dashdot":"solid"}},createNode:function(a,b){var c=document.createElement(a);b&&(c.id=b);c.unselectable="on";c.onselectstart=OpenLayers.Function.False;return c},nodeTypeCompare:function(a,b){var c=b,d=c.indexOf(":");-1!=d&&(c=c.substr(d+1));var e=a.nodeName,d=e.indexOf(":");-1!=d&&(e=e.substr(d+1));return c==e},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div")},createRoot:function(a){return this.nodeFactory(this.container.id+a,"olv:group")},drawPoint:function(a,b){return this.drawCircle(a,b,1)},drawCircle:function(a,b,c){if(!isNaN(b.x)&&!isNaN(b.y)){var d=this.getResolution();a.style.left=((b.x-this.featureDx)/d-this.offset.x|0)-c+"px";a.style.top=(b.y/d-this.offset.y|0)-c+"px";b=2*c;a.style.width=b+"px";a.style.height=b+"px";return a}return!1},drawLineString:function(a,b){return this.drawLine(a,b,!1)},drawLinearRing:function(a,b){return this.drawLine(a,b,!0)},drawLine:function(a,b,c){this.setNodeDimension(a,b);for(var d=this.getResolution(),e=b.components.length,f=Array(e),g,h,i=0;i<e;i++)g=b.components[i],h=(g.x-this.featureDx)/d-this.offset.x|0,g=g.y/d-this.offset.y|0,f[i]=" "+h+","+g+" l ";a.path="m"+f.join("")+(c?" x e":" e");return a},drawPolygon:function(a,b){this.setNodeDimension(a,b);var c=this.getResolution(),d=[],e,f,g,h,i,j,k,l,m,n;e=0;for(f=b.components.length;e<f;e++){d.push("m");g=b.components[e].components;h=0===e;j=i=null;k=0;for(l=g.length;k<l;k++)m=g[k],n=(m.x-this.featureDx)/c-this.offset.x|0,m=m.y/c-this.offset.y|0,n=" "+n+","+m,d.push(n),0==k&&d.push(" l"),h||(i?i!=n&&(j?j!=n&&(h=!0):j=n):i=n);d.push(h?" x ":" ")}d.push("e");a.path=d.join("");return a},drawRectangle:function(a,b){var c=this.getResolution();a.style.left=((b.x-this.featureDx)/c-this.offset.x|0)+"px";a.style.top=(b.y/c-this.offset.y|0)+"px";a.style.width=(b.width/c|0)+"px";a.style.height=(b.height/c|0)+"px";return a},drawText:function(a,b,c){var d=this.nodeFactory(a+this.LABEL_ID_SUFFIX,"olv:rect"),e=this.nodeFactory(a+this.LABEL_ID_SUFFIX+"_textbox","olv:textbox"),f=this.getResolution();d.style.left=((c.x-this.featureDx)/f-this.offset.x|0)+"px";d.style.top=(c.y/f-this.offset.y|0)+"px";d.style.flip="y";e.innerText=b.label;"inherit"!=b.cursor&&null!=b.cursor&&(e.style.cursor=b.cursor);b.fontColor&&(e.style.color=b.fontColor);b.fontOpacity&&(e.style.filter="alpha(opacity="+100*b.fontOpacity+")");b.fontFamily&&(e.style.fontFamily=b.fontFamily);b.fontSize&&(e.style.fontSize=b.fontSize);b.fontWeight&&(e.style.fontWeight=b.fontWeight);b.fontStyle&&(e.style.fontStyle=b.fontStyle);!0===b.labelSelect&&(d._featureId=a,e._featureId=a,e._geometry=c,e._geometryClass=c.CLASS_NAME);e.style.whiteSpace="nowrap";e.inset="1px,0px,0px,0px";d.parentNode||(d.appendChild(e),this.textRoot.appendChild(d));b=b.labelAlign||"cm";1==b.length&&(b+="m");a=e.clientWidth*OpenLayers.Renderer.VML.LABEL_SHIFT[b.substr(0,1)];e=e.clientHeight*OpenLayers.Renderer.VML.LABEL_SHIFT[b.substr(1,1)];d.style.left=parseInt(d.style.left)-a-1+"px";d.style.top=parseInt(d.style.top)+e+"px"},moveRoot:function(a){var b=this.map.getLayer(a.container.id);b instanceof OpenLayers.Layer.Vector.RootContainer&&(b=this.map.getLayer(this.container.id));b&&b.renderer.clear();OpenLayers.Renderer.Elements.prototype.moveRoot.apply(this,arguments);b&&b.redraw()},importSymbol:function(a){var b=this.container.id+"-"+a,c=this.symbolCache[b];if(c)return c;c=OpenLayers.Renderer.symbol[a];if(!c)throw Error(a+" is not a valid symbol name");for(var a=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0),d=["m"],e=0;e<c.length;e+=2){var f=c[e],g=c[e+1];a.left=Math.min(a.left,f);a.bottom=Math.min(a.bottom,g);a.right=Math.max(a.right,f);a.top=Math.max(a.top,g);d.push(f);d.push(g);0==e&&d.push("l")}d.push("x e");c=d.join(" ");d=(a.getWidth()-a.getHeight())/2;0<d?(a.bottom-=d,a.top+=d):(a.left+=d,a.right-=d);c={path:c,size:a.getWidth(),left:a.left,bottom:a.bottom};return this.symbolCache[b]=c},CLASS_NAME:"OpenLayers.Renderer.VML"});OpenLayers.Renderer.VML.LABEL_SHIFT={l:0,c:.5,r:1,t:0,m:.5,b:1};OpenLayers.Control.CacheRead=OpenLayers.Class(OpenLayers.Control,{fetchEvent:"tileloadstart",layers:null,autoActivate:!0,setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);var b,c=this.layers||a.layers;for(b=c.length-1;0<=b;--b)this.addLayer({layer:c[b]});if(!this.layers)a.events.on({addlayer:this.addLayer,removeLayer:this.removeLayer,scope:this})},addLayer:function(a){a.layer.events.register(this.fetchEvent,this,this.fetch)},removeLayer:function(a){a.layer.events.unregister(this.fetchEvent,this,this.fetch)},fetch:function(a){if(this.active&&window.localStorage&&a.tile instanceof OpenLayers.Tile.Image){var b=a.tile,c=b.url;!b.layer.crossOriginKeyword&&(OpenLayers.ProxyHost&&0===c.indexOf(OpenLayers.ProxyHost))&&(c=OpenLayers.Control.CacheWrite.urlMap[c]);if(c=window.localStorage.getItem("olCache_"+c))b.url=c,"tileerror"===a.type&&b.setImgSrc(c)}},destroy:function(){if(this.layers||this.map){var a,b=this.layers||this.map.layers;for(a=b.length-1;0<=a;--a)this.removeLayer({layer:b[a]})}this.map&&this.map.events.un({addlayer:this.addLayer,removeLayer:this.removeLayer,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments)},CLASS_NAME:"OpenLayers.Control.CacheRead"});OpenLayers.Protocol.WFS.v1_0_0=OpenLayers.Class(OpenLayers.Protocol.WFS.v1,{version:"1.0.0",CLASS_NAME:"OpenLayers.Protocol.WFS.v1_0_0"});OpenLayers.Format.WMSGetFeatureInfo=OpenLayers.Class(OpenLayers.Format.XML,{layerIdentifier:"_layer",featureIdentifier:"_feature",regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},gmlFormat:null,read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));var b=a.documentElement;if(b)var c=this["read_"+b.nodeName],a=c?c.call(this,b):new OpenLayers.Format.GML(this.options?this.options:{}).read(a);return a},read_msGMLOutput:function(a){var b=[];if(a=this.getSiblingNodesByTagCriteria(a,this.layerIdentifier))for(var c=0,d=a.length;c<d;++c){var e=a[c],f=e.nodeName;e.prefix&&(f=f.split(":")[1]);f=f.replace(this.layerIdentifier,"");if(e=this.getSiblingNodesByTagCriteria(e,this.featureIdentifier))for(var g=0;g<e.length;g++){var h=e[g],i=this.parseGeometry(h),h=this.parseAttributes(h),h=new OpenLayers.Feature.Vector(i.geometry,h,null);h.bounds=i.bounds;h.type=f;b.push(h)}}return b},read_FeatureInfoResponse:function(a){for(var b=[],a=this.getElementsByTagNameNS(a,"*","FIELDS"),c=0,d=a.length;c<d;c++){var e=a[c],f={},g,h=e.attributes.length;if(0<h)for(g=0;g<h;g++){var i=e.attributes[g];f[i.nodeName]=i.nodeValue}else{e=e.childNodes;g=0;for(h=e.length;g<h;++g)i=e[g],3!=i.nodeType&&(f[i.getAttribute("name")]=i.getAttribute("value"))}b.push(new OpenLayers.Feature.Vector(null,f,null))}return b},getSiblingNodesByTagCriteria:function(a,b){var c=[],d,e,f,g;if(a&&a.hasChildNodes()){d=a.childNodes;f=d.length;for(var h=0;h<f;h++){for(g=d[h];g&&1!=g.nodeType;)g=g.nextSibling,h++;e=g?g.nodeName:"";0<e.length&&-1<e.indexOf(b)?c.push(g):(e=this.getSiblingNodesByTagCriteria(g,b),0<e.length&&(0==c.length?c=e:c.push(e)))}}return c},parseAttributes:function(a){var b={};if(1==a.nodeType)for(var a=a.childNodes,c=a.length,d=0;d<c;++d){var e=a[d];if(1==e.nodeType){var f=e.childNodes,e=e.prefix?e.nodeName.split(":")[1]:e.nodeName;if(0==f.length)b[e]=null;else if(1==f.length&&(f=f[0],3==f.nodeType||4==f.nodeType))f=f.nodeValue.replace(this.regExes.trimSpace,""),b[e]=f}}return b},parseGeometry:function(a){this.gmlFormat||(this.gmlFormat=new OpenLayers.Format.GML);var a=this.gmlFormat.parseFeature(a),b,c=null;a&&(b=a.geometry&&a.geometry.clone(),c=a.bounds&&a.bounds.clone(),a.destroy());return{geometry:b,bounds:c}},CLASS_NAME:"OpenLayers.Format.WMSGetFeatureInfo"});OpenLayers.Control.WMTSGetFeatureInfo=OpenLayers.Class(OpenLayers.Control,{hover:!1,requestEncoding:"KVP",drillDown:!1,maxFeatures:10,clickCallback:"click",layers:null,queryVisible:!0,infoFormat:"text/html",vendorParams:{},format:null,formatOptions:null,handlerOptions:null,handler:null,hoverRequest:null,pending:0,initialize:function(a){a=a||{};a.handlerOptions=a.handlerOptions||{};OpenLayers.Control.prototype.initialize.apply(this,[a]);this.format||(this.format=new OpenLayers.Format.WMSGetFeatureInfo(a.formatOptions));!0===this.drillDown&&(this.hover=!1);this.hover?this.handler=new OpenLayers.Handler.Hover(this,{move:this.cancelHover,pause:this.getInfoForHover},OpenLayers.Util.extend(this.handlerOptions.hover||{},{delay:250})):(a={},a[this.clickCallback]=this.getInfoForClick,this.handler=new OpenLayers.Handler.Click(this,a,this.handlerOptions.click||{}))},getInfoForClick:function(a){this.request(a.xy,{})},getInfoForHover:function(a){this.request(a.xy,{hover:!0})},cancelHover:function(){this.hoverRequest&&(--this.pending,0>=this.pending&&(OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait"),this.pending=0),this.hoverRequest.abort(),this.hoverRequest=null)},findLayers:function(){for(var a=this.layers||this.map.layers,b=[],c,d=a.length-1;0<=d;--d)if(c=a[d],c instanceof OpenLayers.Layer.WMTS&&c.requestEncoding===this.requestEncoding&&(!this.queryVisible||c.getVisibility()))if(b.push(c),!this.drillDown||this.hover)break;return b},buildRequestOptions:function(a,b){var c=this.map.getLonLatFromPixel(b),d=a.getURL(new OpenLayers.Bounds(c.lon,c.lat,c.lon,c.lat)),d=OpenLayers.Util.getParameters(d),c=a.getTileInfo(c);OpenLayers.Util.extend(d,{service:"WMTS",version:a.version,request:"GetFeatureInfo",infoFormat:this.infoFormat,i:c.i,j:c.j});OpenLayers.Util.applyDefaults(d,this.vendorParams);return{url:OpenLayers.Util.isArray(a.url)?a.url[0]:a.url,params:OpenLayers.Util.upperCaseObject(d),callback:function(c){this.handleResponse(b,c,a)},scope:this}},request:function(a,b){var b=b||{},c=this.findLayers();if(0<c.length){for(var d,e,f=0,g=c.length;f<g;f++)e=c[f],d=this.events.triggerEvent("beforegetfeatureinfo",{xy:a,layer:e}),!1!==d&&(++this.pending,d=this.buildRequestOptions(e,a),d=OpenLayers.Request.GET(d),!0===b.hover&&(this.hoverRequest=d));0<this.pending&&OpenLayers.Element.addClass(this.map.viewPortDiv,"olCursorWait")}},handleResponse:function(a,b,c){--this.pending;0>=this.pending&&(OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait"),this.pending=0);if(b.status&&(200>b.status||300<=b.status))this.events.triggerEvent("exception",{xy:a,request:b,layer:c});else{var d=b.responseXML;if(!d||!d.documentElement)d=b.responseText;var e,f;try{e=this.format.read(d)}catch(g){f=!0,this.events.triggerEvent("exception",{xy:a,request:b,error:g,layer:c})}f||this.events.triggerEvent("getfeatureinfo",{text:b.responseText,features:e,request:b,xy:a,layer:c})}},CLASS_NAME:"OpenLayers.Control.WMTSGetFeatureInfo"});OpenLayers.Strategy.Paging=OpenLayers.Class(OpenLayers.Strategy,{features:null,length:10,num:null,paging:!1,activate:function(){var a=OpenLayers.Strategy.prototype.activate.call(this);if(a)this.layer.events.on({beforefeaturesadded:this.cacheFeatures,scope:this});return a},deactivate:function(){var a=OpenLayers.Strategy.prototype.deactivate.call(this);a&&(this.clearCache(),this.layer.events.un({beforefeaturesadded:this.cacheFeatures,scope:this}));return a},cacheFeatures:function(a){this.paging||(this.clearCache(),this.features=a.features,this.pageNext(a))},clearCache:function(){if(this.features)for(var a=0;a<this.features.length;++a)this.features[a].destroy();this.num=this.features=null},pageCount:function(){return Math.ceil((this.features?this.features.length:0)/this.length)},pageNum:function(){return this.num},pageLength:function(a){a&&0<a&&(this.length=a);return this.length},pageNext:function(a){var b=!1;this.features&&(null===this.num&&(this.num=-1),b=this.page((this.num+1)*this.length,a));return b},pagePrevious:function(){var a=!1;this.features&&(null===this.num&&(this.num=this.pageCount()),a=this.page((this.num-1)*this.length));return a},page:function(a,b){var c=!1;if(this.features&&0<=a&&a<this.features.length){var d=Math.floor(a/this.length);d!=this.num&&(this.paging=!0,c=this.features.slice(a,a+this.length),this.layer.removeFeatures(this.layer.features),this.num=d,b&&b.features?b.features=c:this.layer.addFeatures(c),this.paging=!1,c=!0)}return c},CLASS_NAME:"OpenLayers.Strategy.Paging"});OpenLayers.Protocol.CSW.v2_0_2=OpenLayers.Class(OpenLayers.Protocol,{formatOptions:null,initialize:function(a){OpenLayers.Protocol.prototype.initialize.apply(this,[a]);a.format||(this.format=new OpenLayers.Format.CSWGetRecords.v2_0_2(OpenLayers.Util.extend({},this.formatOptions)))},destroy:function(){this.options&&!this.options.format&&this.format.destroy();this.format=null;OpenLayers.Protocol.prototype.destroy.apply(this)},read:function(a){a=OpenLayers.Util.extend({},a);OpenLayers.Util.applyDefaults(a,this.options||{});var b=new OpenLayers.Protocol.Response({requestType:"read"}),c=this.format.write(a.params);b.priv=OpenLayers.Request.POST({url:a.url,callback:this.createCallback(this.handleRead,b,a),params:a.params,headers:a.headers,data:c});return b},handleRead:function(a,b){if(b.callback){var c=a.priv;200<=c.status&&300>c.status?(a.data=this.parseData(c),a.code=OpenLayers.Protocol.Response.SUCCESS):a.code=OpenLayers.Protocol.Response.FAILURE;b.callback.call(b.scope,a)}},parseData:function(a){var b=a.responseXML;if(!b||!b.documentElement)b=a.responseText;return!b||0>=b.length?null:this.format.read(b)},CLASS_NAME:"OpenLayers.Protocol.CSW.v2_0_2"});OpenLayers.Format.WMSCapabilities.v1_1=OpenLayers.Class(OpenLayers.Format.WMSCapabilities.v1,{readers:{wms:OpenLayers.Util.applyDefaults({WMT_MS_Capabilities:function(a,b){this.readChildNodes(a,b)},Keyword:function(a,b){b.keywords&&b.keywords.push(this.getChildValue(a))},DescribeLayer:function(a,b){b.describelayer={formats:[]};this.readChildNodes(a,b.describelayer)},GetLegendGraphic:function(a,b){b.getlegendgraphic={formats:[]};this.readChildNodes(a,b.getlegendgraphic)},GetStyles:function(a,b){b.getstyles={formats:[]};this.readChildNodes(a,b.getstyles)},PutStyles:function(a,b){b.putstyles={formats:[]};this.readChildNodes(a,b.putstyles)},UserDefinedSymbolization:function(a,b){var c={supportSLD:1==parseInt(a.getAttribute("SupportSLD")),userLayer:1==parseInt(a.getAttribute("UserLayer")),userStyle:1==parseInt(a.getAttribute("UserStyle")),remoteWFS:1==parseInt(a.getAttribute("RemoteWFS"))};b.userSymbols=c},LatLonBoundingBox:function(a,b){b.llbbox=[parseFloat(a.getAttribute("minx")),parseFloat(a.getAttribute("miny")),parseFloat(a.getAttribute("maxx")),parseFloat(a.getAttribute("maxy"))]},BoundingBox:function(a,b){var c=OpenLayers.Format.WMSCapabilities.v1.prototype.readers.wms.BoundingBox.apply(this,[a,b]);c.srs=a.getAttribute("SRS");b.bbox[c.srs]=c},ScaleHint:function(a,b){var c=a.getAttribute("min"),d=a.getAttribute("max"),e=Math.pow(2,.5),f=OpenLayers.INCHES_PER_UNIT.m;b.maxScale=parseFloat((c/e*f*OpenLayers.DOTS_PER_INCH).toPrecision(13));b.minScale=parseFloat((d/e*f*OpenLayers.DOTS_PER_INCH).toPrecision(13))},Dimension:function(a,b){var c={name:a.getAttribute("name").toLowerCase(),units:a.getAttribute("units"),unitsymbol:a.getAttribute("unitSymbol")};b.dimensions[c.name]=c},Extent:function(a,b){var c=a.getAttribute("name").toLowerCase();if(c in b.dimensions){c=b.dimensions[c];c.nearestVal="1"===a.getAttribute("nearestValue");c.multipleVal="1"===a.getAttribute("multipleValues");c.current="1"===a.getAttribute("current");c["default"]=a.getAttribute("default")||"";var d=this.getChildValue(a);c.values=d.split(",")}}},OpenLayers.Format.WMSCapabilities.v1.prototype.readers.wms)},CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1_1"});OpenLayers.Control.Graticule=OpenLayers.Class(OpenLayers.Control,{autoActivate:!0,intervals:[45,30,20,10,5,2,1,.5,.2,.1,.05,.01,.005,.002,.001],displayInLayerSwitcher:!0,visible:!0,numPoints:50,targetSize:200,layerName:null,labelled:!0,labelFormat:"dm",lineSymbolizer:{strokeColor:"#333",strokeWidth:1,strokeOpacity:.5},labelSymbolizer:{},gratLayer:null,initialize:function(a){a=a||{};a.layerName=a.layerName||OpenLayers.i18n("Graticule");OpenLayers.Control.prototype.initialize.apply(this,[a]);this.labelSymbolizer.stroke=!1;this.labelSymbolizer.fill=!1;this.labelSymbolizer.label="${label}";this.labelSymbolizer.labelAlign="${labelAlign}";this.labelSymbolizer.labelXOffset="${xOffset}";this.labelSymbolizer.labelYOffset="${yOffset}"},destroy:function(){this.deactivate();OpenLayers.Control.prototype.destroy.apply(this,arguments);this.gratLayer&&(this.gratLayer.destroy(),this.gratLayer=null)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.gratLayer){var a=new OpenLayers.Style({},{rules:[new OpenLayers.Rule({symbolizer:{Point:this.labelSymbolizer,Line:this.lineSymbolizer}})]});this.gratLayer=new OpenLayers.Layer.Vector(this.layerName,{styleMap:new OpenLayers.StyleMap({"default":a}),visibility:this.visible,displayInLayerSwitcher:this.displayInLayerSwitcher})}return this.div},activate:function(){return OpenLayers.Control.prototype.activate.apply(this,arguments)?(this.map.addLayer(this.gratLayer),this.map.events.register("moveend",this,this.update),this.update(),!0):!1},deactivate:function(){return OpenLayers.Control.prototype.deactivate.apply(this,arguments)?(this.map.events.unregister("moveend",this,this.update),this.map.removeLayer(this.gratLayer),!0):!1},update:function(){var a=this.map.getExtent();if(a){this.gratLayer.destroyFeatures();var b=new OpenLayers.Projection("EPSG:4326"),c=this.map.getProjectionObject(),d=this.map.getResolution();c.proj&&"longlat"==c.proj.projName&&(this.numPoints=1);var e=this.map.getCenter(),f=new OpenLayers.Pixel(e.lon,e.lat);OpenLayers.Projection.transform(f,c,b);for(var e=this.targetSize*d,e=e*e,g,d=0;d<this.intervals.length;++d){g=this.intervals[d];var h=g/2,i=f.offset({x:-h,y:-h}),h=f.offset({x:h,y:h});OpenLayers.Projection.transform(i,b,c);OpenLayers.Projection.transform(h,b,c);if((i.x-h.x)*(i.x-h.x)+(i.y-h.y)*(i.y-h.y)<=e)break}f.x=Math.floor(f.x/g)*g;f.y=Math.floor(f.y/g)*g;var d=0,e=[f.clone()],h=f.clone(),j;do h=h.offset({x:0,y:g}),j=OpenLayers.Projection.transform(h.clone(),b,c),e.unshift(h);while(a.containsPixel(j)&&1e3>++d);h=f.clone();do h=h.offset({x:0,y:-g}),j=OpenLayers.Projection.transform(h.clone(),b,c),e.push(h);while(a.containsPixel(j)&&1e3>++d);d=0;i=[f.clone()];h=f.clone();do h=h.offset({x:-g,y:0}),j=OpenLayers.Projection.transform(h.clone(),b,c),i.unshift(h);while(a.containsPixel(j)&&1e3>++d);h=f.clone();do h=h.offset({x:g,y:0}),j=OpenLayers.Projection.transform(h.clone(),b,c),i.push(h);while(a.containsPixel(j)&&1e3>++d);g=[];for(d=0;d<i.length;++d){j=i[d].x;for(var f=[],k=null,l=Math.min(e[0].y,90),h=Math.max(e[e.length-1].y,-90),m=(l-h)/this.numPoints,l=h,h=0;h<=this.numPoints;++h){var n=new OpenLayers.Geometry.Point(j,l);n.transform(b,c);f.push(n);l+=m;n.y>=a.bottom&&!k&&(k=n)}this.labelled&&(k=new OpenLayers.Geometry.Point(k.x,a.bottom),j={value:j,label:this.labelled?OpenLayers.Util.getFormattedLonLat(j,"lon",this.labelFormat):"",labelAlign:"cb",xOffset:0,yOffset:2},this.gratLayer.addFeatures(new OpenLayers.Feature.Vector(k,j)));f=new OpenLayers.Geometry.LineString(f);g.push(new OpenLayers.Feature.Vector(f))}for(h=0;h<e.length;++h)if(l=e[h].y,!(-90>l||90<l)){f=[];d=i[0].x;m=(i[i.length-1].x-d)/this.numPoints;j=d;k=null;for(d=0;d<=this.numPoints;++d)n=new OpenLayers.Geometry.Point(j,l),n.transform(b,c),f.push(n),j+=m,n.x<a.right&&(k=n);this.labelled&&(k=new OpenLayers.Geometry.Point(a.right,k.y),j={value:l,label:this.labelled?OpenLayers.Util.getFormattedLonLat(l,"lat",this.labelFormat):"",labelAlign:"rb",xOffset:-2,yOffset:2},this.gratLayer.addFeatures(new OpenLayers.Feature.Vector(k,j)));f=new OpenLayers.Geometry.LineString(f);g.push(new OpenLayers.Feature.Vector(f))}this.gratLayer.addFeatures(g)}},CLASS_NAME:"OpenLayers.Control.Graticule"});OpenLayers.Layer.UTFGrid=OpenLayers.Class(OpenLayers.Layer.XYZ,{isBaseLayer:!1,projection:new OpenLayers.Projection("EPSG:900913"),useJSONP:!1,tileClass:OpenLayers.Tile.UTFGrid,initialize:function(a){OpenLayers.Layer.Grid.prototype.initialize.apply(this,[a.name,a.url,{},a]);this.tileOptions=OpenLayers.Util.extend({utfgridResolution:this.utfgridResolution},this.tileOptions)},clone:function(a){null==a&&(a=new OpenLayers.Layer.UTFGrid(this.getOptions()));return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a])},getFeatureInfo:function(a){var b=null,a=this.getTileData(a);a.tile&&(b=a.tile.getFeatureInfo(a.i,a.j));return b},getFeatureId:function(a){var b=null,a=this.getTileData(a);a.tile&&(b=a.tile.getFeatureId(a.i,a.j));return b},CLASS_NAME:"OpenLayers.Layer.UTFGrid"});OpenLayers.Layer.ArcGISCache=OpenLayers.Class(OpenLayers.Layer.XYZ,{url:null,tileOrigin:null,tileSize:new OpenLayers.Size(256,256),useArcGISServer:!0,type:"png",useScales:!1,overrideDPI:!1,initialize:function(a,b,c){OpenLayers.Layer.XYZ.prototype.initialize.apply(this,arguments);this.resolutions&&(this.serverResolutions=this.resolutions,this.maxExtent=this.getMaxExtentForResolution(this.resolutions[0]));if(this.layerInfo){var d=this.layerInfo,e=new OpenLayers.Bounds(d.fullExtent.xmin,d.fullExtent.ymin,d.fullExtent.xmax,d.fullExtent.ymax);this.projection="EPSG:"+d.spatialReference.wkid;this.sphericalMercator=102100==d.spatialReference.wkid;this.units="esriFeet"==d.units?"ft":"m";if(d.tileInfo){this.tileSize=new OpenLayers.Size(d.tileInfo.width||d.tileInfo.cols,d.tileInfo.height||d.tileInfo.rows);this.tileOrigin=new OpenLayers.LonLat(d.tileInfo.origin.x,d.tileInfo.origin.y);var f=new OpenLayers.Geometry.Point(e.left,e.top),e=new OpenLayers.Geometry.Point(e.right,e.bottom);this.useScales?this.scales=[]:this.resolutions=[];this.lods=[];for(var g in d.tileInfo.lods)if(d.tileInfo.lods.hasOwnProperty(g)){var h=d.tileInfo.lods[g];this.useScales?this.scales.push(h.scale):this.resolutions.push(h.resolution);var i=this.getContainingTileCoords(f,h.resolution);h.startTileCol=i.x;h.startTileRow=i.y;i=this.getContainingTileCoords(e,h.resolution);h.endTileCol=i.x;h.endTileRow=i.y;this.lods.push(h)}this.maxExtent=this.calculateMaxExtentWithLOD(this.lods[0]);this.serverResolutions=this.resolutions;this.overrideDPI&&d.tileInfo.dpi&&(OpenLayers.DOTS_PER_INCH=d.tileInfo.dpi)}}},getContainingTileCoords:function(a,b){return new OpenLayers.Pixel(Math.max(Math.floor((a.x-this.tileOrigin.lon)/(this.tileSize.w*b)),0),Math.max(Math.floor((this.tileOrigin.lat-a.y)/(this.tileSize.h*b)),0))},calculateMaxExtentWithLOD:function(a){var b=this.tileOrigin.lon+a.startTileCol*this.tileSize.w*a.resolution,c=this.tileOrigin.lat-a.startTileRow*this.tileSize.h*a.resolution;return new OpenLayers.Bounds(b,c-(a.endTileRow-a.startTileRow+1)*this.tileSize.h*a.resolution,b+(a.endTileCol-a.startTileCol+1)*this.tileSize.w*a.resolution,c)},calculateMaxExtentWithExtent:function(a,b){var c=new OpenLayers.Geometry.Point(a.left,a.top),d=new OpenLayers.Geometry.Point(a.right,a.bottom),c=this.getContainingTileCoords(c,b),d=this.getContainingTileCoords(d,b);return this.calculateMaxExtentWithLOD({resolution:b,startTileCol:c.x,startTileRow:c.y,endTileCol:d.x,endTileRow:d.y})},getUpperLeftTileCoord:function(a){return this.getContainingTileCoords(new OpenLayers.Geometry.Point(this.maxExtent.left,this.maxExtent.top),a)},getLowerRightTileCoord:function(a){return this.getContainingTileCoords(new OpenLayers.Geometry.Point(this.maxExtent.right,this.maxExtent.bottom),a)},getMaxExtentForResolution:function(a){var b=this.getUpperLeftTileCoord(a),c=this.getLowerRightTileCoord(a),d=this.tileOrigin.lon+b.x*this.tileSize.w*a,e=this.tileOrigin.lat-b.y*this.tileSize.h*a;return new OpenLayers.Bounds(d,e-(c.y-b.y+1)*this.tileSize.h*a,d+(c.x-b.x+1)*this.tileSize.w*a,e)},clone:function(a){null==a&&(a=new OpenLayers.Layer.ArcGISCache(this.name,this.url,this.options));return OpenLayers.Layer.XYZ.prototype.clone.apply(this,[a])},getMaxExtent:function(){return this.maxExtent=this.getMaxExtentForResolution(this.map.getResolution())},getTileOrigin:function(){var a=this.getMaxExtent();return new OpenLayers.LonLat(a.left,a.bottom)},getURL:function(a){var b=this.getResolution(),c=this.tileOrigin.lon+b*this.tileSize.w/2,d=this.tileOrigin.lat-b*this.tileSize.h/2,a=a.getCenterLonLat(),c=Math.round(Math.abs((a.lon-c)/(b*this.tileSize.w))),d=Math.round(Math.abs((d-a.lat)/(b*this.tileSize.h))),a=this.map.getZoom();if(this.lods){if(b=this.lods[this.map.getZoom()],c<b.startTileCol||c>b.endTileCol||d<b.startTileRow||d>b.endTileRow)return null}else{var e=this.getUpperLeftTileCoord(b),b=this.getLowerRightTileCoord(b);if(c<e.x||c>=b.x||d<e.y||d>=b.y)return null}b=this.url;e=""+c+d+a;OpenLayers.Util.isArray(b)&&(b=this.selectUrl(e,b));this.useArcGISServer?b+="/tile/${z}/${y}/${x}":(c="C"+this.zeroPad(c,8,16),d="R"+this.zeroPad(d,8,16),a="L"+this.zeroPad(a,2,16),b=b+"/${z}/${y}/${x}."+this.type);b=OpenLayers.String.format(b,{x:c,y:d,z:a});return OpenLayers.Util.urlAppend(b,OpenLayers.Util.getParameterString(this.params))},zeroPad:function(a,b,c){for(a=a.toString(c||10);a.length<b;)a="0"+a;return a},CLASS_NAME:"OpenLayers.Layer.ArcGISCache"});OpenLayers.Control.WMSGetFeatureInfo=OpenLayers.Class(OpenLayers.Control,{hover:!1,drillDown:!1,maxFeatures:10,clickCallback:"click",output:"features",layers:null,queryVisible:!1,url:null,layerUrls:null,infoFormat:"text/html",vendorParams:{},format:null,formatOptions:null,handlerOptions:null,handler:null,hoverRequest:null,initialize:function(a){a=a||{};a.handlerOptions=a.handlerOptions||{};OpenLayers.Control.prototype.initialize.apply(this,[a]);this.format||(this.format=new OpenLayers.Format.WMSGetFeatureInfo(a.formatOptions));!0===this.drillDown&&(this.hover=!1);this.hover?this.handler=new OpenLayers.Handler.Hover(this,{move:this.cancelHover,pause:this.getInfoForHover},OpenLayers.Util.extend(this.handlerOptions.hover||{},{delay:250})):(a={},a[this.clickCallback]=this.getInfoForClick,this.handler=new OpenLayers.Handler.Click(this,a,this.handlerOptions.click||{}))},getInfoForClick:function(a){this.events.triggerEvent("beforegetfeatureinfo",{xy:a.xy});OpenLayers.Element.addClass(this.map.viewPortDiv,"olCursorWait");this.request(a.xy,{})},getInfoForHover:function(a){this.events.triggerEvent("beforegetfeatureinfo",{xy:a.xy});this.request(a.xy,{hover:!0})},cancelHover:function(){this.hoverRequest&&(this.hoverRequest.abort(),this.hoverRequest=null)},findLayers:function(){for(var a=this.layers||this.map.layers,b=[],c,d,e=a.length-1;0<=e;--e)if(c=a[e],c instanceof OpenLayers.Layer.WMS&&(!this.queryVisible||c.getVisibility()))d=OpenLayers.Util.isArray(c.url)?c.url[0]:c.url,!1===this.drillDown&&!this.url&&(this.url=d),(!0===this.drillDown||this.urlMatches(d))&&b.push(c);return b},urlMatches:function(a){var b=OpenLayers.Util.isEquivalentUrl(this.url,a);if(!b&&this.layerUrls)for(var c=0,d=this.layerUrls.length;c<d;++c)if(OpenLayers.Util.isEquivalentUrl(this.layerUrls[c],a)){b=!0;break}return b},buildWMSOptions:function(a,b,c,d){for(var e=[],f=[],g=0,h=b.length;g<h;g++)null!=b[g].params.LAYERS&&(e=e.concat(b[g].params.LAYERS),f=f.concat(this.getStyleNames(b[g])));b=b[0];g=this.map.getProjection();(h=b.projection)&&h.equals(this.map.getProjectionObject())&&(g=h.getCode());d=OpenLayers.Util.extend({service:"WMS",version:b.params.VERSION,request:"GetFeatureInfo",exceptions:b.params.EXCEPTIONS,bbox:this.map.getExtent().toBBOX(null,b.reverseAxisOrder()),feature_count:this.maxFeatures,height:this.map.getSize().h,width:this.map.getSize().w,format:d,info_format:b.params.INFO_FORMAT||this.infoFormat},1.3<=parseFloat(b.params.VERSION)?{crs:g,i:parseInt(c.x),j:parseInt(c.y)}:{srs:g,x:parseInt(c.x),y:parseInt(c.y)});0!=e.length&&(d=OpenLayers.Util.extend({layers:e,query_layers:e,styles:f},d));OpenLayers.Util.applyDefaults(d,this.vendorParams);return{url:a,params:OpenLayers.Util.upperCaseObject(d),callback:function(b){this.handleResponse(c,b,a)},scope:this}},getStyleNames:function(a){return a.params.STYLES?a.params.STYLES:OpenLayers.Util.isArray(a.params.LAYERS)?Array(a.params.LAYERS.length):a.params.LAYERS.replace(/[^,]/g,"")},request:function(a,b){var c=this.findLayers();if(0==c.length)this.events.triggerEvent("nogetfeatureinfo"),OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait");else if(b=b||{},!1===this.drillDown){var c=this.buildWMSOptions(this.url,c,a,c[0].params.FORMAT),d=OpenLayers.Request.GET(c);!0===b.hover&&(this.hoverRequest=d)}else{this._numRequests=this._requestCount=0;this.features=[];for(var d={},e,f=0,g=c.length;f<g;f++){var h=c[f];e=OpenLayers.Util.isArray(h.url)?h.url[0]:h.url;e in d?d[e].push(h):(this._numRequests++,d[e]=[h])}for(e in d)c=d[e],c=this.buildWMSOptions(e,c,a,c[0].params.FORMAT),OpenLayers.Request.GET(c)}},triggerGetFeatureInfo:function(a,b,c){this.events.triggerEvent("getfeatureinfo",{text:a.responseText,features:c,request:a,xy:b});OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait")},handleResponse:function(a,b,c){var d=b.responseXML;if(!d||!d.documentElement)d=b.responseText;d=this.format.read(d);!1===this.drillDown?this.triggerGetFeatureInfo(b,a,d):(this._requestCount++,this._features="object"===this.output?(this._features||[]).concat({url:c,features:d}):(this._features||[]).concat(d),this._requestCount===this._numRequests&&(this.triggerGetFeatureInfo(b,a,this._features.concat()),delete this._features,delete this._requestCount,delete this._numRequests))},CLASS_NAME:"OpenLayers.Control.WMSGetFeatureInfo"});OpenLayers.Format.WMSCapabilities.v1_3_0=OpenLayers.Class(OpenLayers.Format.WMSCapabilities.v1_3,{version:"1.3.0",CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1_3_0"});OpenLayers.Format.SOSGetFeatureOfInterest=OpenLayers.Class(OpenLayers.Format.XML,{VERSION:"1.0.0",namespaces:{sos:"http://www.opengis.net/sos/1.0",gml:"http://www.opengis.net/gml",sa:"http://www.opengis.net/sampling/1.0",xsi:"http://www.w3.org/2001/XMLSchema-instance"},schemaLocation:"http://www.opengis.net/sos/1.0 http://schemas.opengis.net/sos/1.0.0/sosAll.xsd",defaultPrefix:"sos",regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},read:function(a){
"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a&&9==a.nodeType&&(a=a.documentElement);var b={features:[]};this.readNode(a,b);for(var a=[],c=0,d=b.features.length;c<d;c++){var e=b.features[c];this.internalProjection&&(this.externalProjection&&e.components[0])&&e.components[0].transform(this.externalProjection,this.internalProjection);e=new OpenLayers.Feature.Vector(e.components[0],e.attributes);a.push(e)}return a},readers:{sa:{SamplingPoint:function(a,b){if(!b.attributes){var c={attributes:{}};b.features.push(c);b=c}b.attributes.id=this.getAttributeNS(a,this.namespaces.gml,"id");this.readChildNodes(a,b)},position:function(a,b){this.readChildNodes(a,b)}},gml:OpenLayers.Util.applyDefaults({FeatureCollection:function(a,b){this.readChildNodes(a,b)},featureMember:function(a,b){var c={attributes:{}};b.features.push(c);this.readChildNodes(a,c)},name:function(a,b){b.attributes.name=this.getChildValue(a)},pos:function(a,b){this.externalProjection||(this.externalProjection=new OpenLayers.Projection(a.getAttribute("srsName")));OpenLayers.Format.GML.v3.prototype.readers.gml.pos.apply(this,[a,b])}},OpenLayers.Format.GML.v3.prototype.readers.gml)},writers:{sos:{GetFeatureOfInterest:function(a){for(var b=this.createElementNSPlus("GetFeatureOfInterest",{attributes:{version:this.VERSION,service:"SOS","xsi:schemaLocation":this.schemaLocation}}),c=0,d=a.fois.length;c<d;c++)this.writeNode("FeatureOfInterestId",{foi:a.fois[c]},b);return b},FeatureOfInterestId:function(a){return this.createElementNSPlus("FeatureOfInterestId",{value:a.foi})}}},CLASS_NAME:"OpenLayers.Format.SOSGetFeatureOfInterest"});OpenLayers.Format.SOSGetObservation=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ows:"http://www.opengis.net/ows",gml:"http://www.opengis.net/gml",sos:"http://www.opengis.net/sos/1.0",ogc:"http://www.opengis.net/ogc",om:"http://www.opengis.net/om/1.0",sa:"http://www.opengis.net/sampling/1.0",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},VERSION:"1.0.0",schemaLocation:"http://www.opengis.net/sos/1.0 http://schemas.opengis.net/sos/1.0.0/sosGetObservation.xsd",defaultPrefix:"sos",read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a&&9==a.nodeType&&(a=a.documentElement);var b={measurements:[],observations:[]};this.readNode(a,b);return b},write:function(a){a=this.writeNode("sos:GetObservation",a);a.setAttribute("xmlns:om",this.namespaces.om);a.setAttribute("xmlns:ogc",this.namespaces.ogc);this.setAttributeNS(a,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[a])},readers:{om:{ObservationCollection:function(a,b){b.id=this.getAttributeNS(a,this.namespaces.gml,"id");this.readChildNodes(a,b)},member:function(a,b){this.readChildNodes(a,b)},Measurement:function(a,b){var c={};b.measurements.push(c);this.readChildNodes(a,c)},Observation:function(a,b){var c={};b.observations.push(c);this.readChildNodes(a,c)},samplingTime:function(a,b){var c={};b.samplingTime=c;this.readChildNodes(a,c)},observedProperty:function(a,b){b.observedProperty=this.getAttributeNS(a,this.namespaces.xlink,"href");this.readChildNodes(a,b)},procedure:function(a,b){b.procedure=this.getAttributeNS(a,this.namespaces.xlink,"href");this.readChildNodes(a,b)},featureOfInterest:function(a,b){var c={features:[]};b.fois=[];b.fois.push(c);this.readChildNodes(a,c);for(var d=[],e=0,f=c.features.length;e<f;e++){var g=c.features[e];d.push(new OpenLayers.Feature.Vector(g.components[0],g.attributes))}c.features=d},result:function(a,b){var c={};b.result=c;""!==this.getChildValue(a)?(c.value=this.getChildValue(a),c.uom=a.getAttribute("uom")):this.readChildNodes(a,c)}},sa:OpenLayers.Format.SOSGetFeatureOfInterest.prototype.readers.sa,gml:OpenLayers.Util.applyDefaults({TimeInstant:function(a,b){var c={};b.timeInstant=c;this.readChildNodes(a,c)},timePosition:function(a,b){b.timePosition=this.getChildValue(a)}},OpenLayers.Format.SOSGetFeatureOfInterest.prototype.readers.gml)},writers:{sos:{GetObservation:function(a){var b=this.createElementNSPlus("GetObservation",{attributes:{version:this.VERSION,service:"SOS"}});this.writeNode("offering",a,b);a.eventTime&&this.writeNode("eventTime",a,b);for(var c in a.procedures)this.writeNode("procedure",a.procedures[c],b);for(var d in a.observedProperties)this.writeNode("observedProperty",a.observedProperties[d],b);a.foi&&this.writeNode("featureOfInterest",a.foi,b);this.writeNode("responseFormat",a,b);a.resultModel&&this.writeNode("resultModel",a,b);a.responseMode&&this.writeNode("responseMode",a,b);return b},featureOfInterest:function(a){var b=this.createElementNSPlus("featureOfInterest");this.writeNode("ObjectID",a.objectId,b);return b},ObjectID:function(a){return this.createElementNSPlus("ObjectID",{value:a})},responseFormat:function(a){return this.createElementNSPlus("responseFormat",{value:a.responseFormat})},procedure:function(a){return this.createElementNSPlus("procedure",{value:a})},offering:function(a){return this.createElementNSPlus("offering",{value:a.offering})},observedProperty:function(a){return this.createElementNSPlus("observedProperty",{value:a})},eventTime:function(a){var b=this.createElementNSPlus("eventTime");"latest"===a.eventTime&&this.writeNode("ogc:TM_Equals",a,b);return b},resultModel:function(a){return this.createElementNSPlus("resultModel",{value:a.resultModel})},responseMode:function(a){return this.createElementNSPlus("responseMode",{value:a.responseMode})}},ogc:{TM_Equals:function(a){var b=this.createElementNSPlus("ogc:TM_Equals");this.writeNode("ogc:PropertyName",{property:"urn:ogc:data:time:iso8601"},b);"latest"===a.eventTime&&this.writeNode("gml:TimeInstant",{value:"latest"},b);return b},PropertyName:function(a){return this.createElementNSPlus("ogc:PropertyName",{value:a.property})}},gml:{TimeInstant:function(a){var b=this.createElementNSPlus("gml:TimeInstant");this.writeNode("gml:timePosition",a,b);return b},timePosition:function(a){return this.createElementNSPlus("gml:timePosition",{value:a.value})}}},CLASS_NAME:"OpenLayers.Format.SOSGetObservation"});OpenLayers.Control.UTFGrid=OpenLayers.Class(OpenLayers.Control,{autoActivate:!0,layers:null,defaultHandlerOptions:{delay:300,pixelTolerance:4,stopMove:!1,single:!0,"double":!1,stopSingle:!1,stopDouble:!1},handlerMode:"click",setHandler:function(a){this.handlerMode=a;this.resetHandler()},resetHandler:function(){this.handler&&(this.handler.deactivate(),this.handler.destroy(),this.handler=null);"hover"==this.handlerMode?this.handler=new OpenLayers.Handler.Hover(this,{pause:this.handleEvent,move:this.reset},this.handlerOptions):"click"==this.handlerMode?this.handler=new OpenLayers.Handler.Click(this,{click:this.handleEvent},this.handlerOptions):"move"==this.handlerMode&&(this.handler=new OpenLayers.Handler.Hover(this,{pause:this.handleEvent,move:this.handleEvent},this.handlerOptions));return this.handler?!0:!1},initialize:function(a){a=a||{};a.handlerOptions=a.handlerOptions||this.defaultHandlerOptions;OpenLayers.Control.prototype.initialize.apply(this,[a]);this.resetHandler()},handleEvent:function(a){if(null==a)this.reset();else{var b=this.map.getLonLatFromPixel(a.xy);if(b){var c=this.findLayers();if(0<c.length){for(var d={},e,f,g=0,h=c.length;g<h;g++)e=c[g],f=OpenLayers.Util.indexOf(this.map.layers,e),d[f]=e.getFeatureInfo(b);this.callback(d,b,a.xy)}}}},callback:function(){},reset:function(){this.callback(null)},findLayers:function(){for(var a=this.layers||this.map.layers,b=[],c,d=a.length-1;0<=d;--d)c=a[d],c instanceof OpenLayers.Layer.UTFGrid&&b.push(c);return b},CLASS_NAME:"OpenLayers.Control.UTFGrid"});OpenLayers.Format.CQL=function(){function a(a){function b(){var a=e.pop();switch(a.type){case"LOGICAL":var c=b(),g=b();return new OpenLayers.Filter.Logical({filters:[g,c],type:f[a.text.toUpperCase()]});case"NOT":return c=b(),new OpenLayers.Filter.Logical({filters:[c],type:OpenLayers.Filter.Logical.NOT});case"BETWEEN":return e.pop(),g=b(),a=b(),c=b(),new OpenLayers.Filter.Comparison({property:c,lowerBoundary:a,upperBoundary:g,type:OpenLayers.Filter.Comparison.BETWEEN});case"COMPARISON":return g=b(),c=b(),new OpenLayers.Filter.Comparison({property:c,value:g,type:d[a.text.toUpperCase()]});case"VALUE":return/^'.*'$/.test(a.text)?a.text.substr(1,a.text.length-2):Number(a.text);case"SPATIAL":switch(a.text.toUpperCase()){case"BBOX":var c=b(),a=b(),g=b(),h=b(),i=b();return new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.BBOX,property:i,value:OpenLayers.Bounds.fromArray([h,g,a,c])});case"INTERSECTS":return g=b(),c=b(),new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.INTERSECTS,property:c,value:g});case"WITHIN":return g=b(),c=b(),new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.WITHIN,property:c,value:g});case"CONTAINS":return g=b(),c=b(),new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.CONTAINS,property:c,value:g});case"DWITHIN":return a=b(),g=b(),c=b(),new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.DWITHIN,value:g,property:c,distance:Number(a)})}case"GEOMETRY":return OpenLayers.Geometry.fromWKT(a.text);default:return a.text}}for(var c=[],e=[];a.length;){var g=a.shift();switch(g.type){case"PROPERTY":case"GEOMETRY":case"VALUE":e.push(g);break;case"COMPARISON":case"BETWEEN":case"LOGICAL":for(var i=h[g.type];0<c.length&&h[c[c.length-1].type]<=i;)e.push(c.pop());c.push(g);break;case"SPATIAL":case"NOT":case"LPAREN":c.push(g);break;case"RPAREN":for(;0<c.length&&"LPAREN"!=c[c.length-1].type;)e.push(c.pop());c.pop();0<c.length&&"SPATIAL"==c[c.length-1].type&&e.push(c.pop());case"COMMA":case"END":break;default:throw Error("Unknown token type "+g.type)}}for(;0<c.length;)e.push(c.pop());a=b();if(0<e.length){a="Remaining tokens after building AST: \n";for(c=e.length-1;0<=c;c--)a+=e[c].type+": "+e[c].text+"\n";throw Error(a)}return a}var b={PROPERTY:/^[_a-zA-Z]\w*/,COMPARISON:/^(=|<>|<=|<|>=|>|LIKE)/i,COMMA:/^,/,LOGICAL:/^(AND|OR)/i,VALUE:/^('\w+'|\d+(\.\d*)?|\.\d+)/,LPAREN:/^\(/,RPAREN:/^\)/,SPATIAL:/^(BBOX|INTERSECTS|DWITHIN|WITHIN|CONTAINS)/i,NOT:/^NOT/i,BETWEEN:/^BETWEEN/i,GEOMETRY:function(a){var b=/^(POINT|LINESTRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION)/.exec(a);if(b){var c=a.length,b=a.indexOf("(",b[0].length);if(-1<b)for(var d=1;b<c&&0<d;)switch(b++,a.charAt(b)){case"(":d++;break;case")":d--}return[a.substr(0,b+1)]}},END:/^$/},c={LPAREN:["GEOMETRY","SPATIAL","PROPERTY","VALUE","LPAREN"],RPAREN:["NOT","LOGICAL","END","RPAREN"],PROPERTY:["COMPARISON","BETWEEN","COMMA"],BETWEEN:["VALUE"],COMPARISON:["VALUE"],COMMA:["GEOMETRY","VALUE","PROPERTY"],VALUE:["LOGICAL","COMMA","RPAREN","END"],SPATIAL:["LPAREN"],LOGICAL:["NOT","VALUE","SPATIAL","PROPERTY","LPAREN"],NOT:["PROPERTY","LPAREN"],GEOMETRY:["COMMA","RPAREN"]},d={"=":OpenLayers.Filter.Comparison.EQUAL_TO,"<>":OpenLayers.Filter.Comparison.NOT_EQUAL_TO,"<":OpenLayers.Filter.Comparison.LESS_THAN,"<=":OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO,">":OpenLayers.Filter.Comparison.GREATER_THAN,">=":OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO,LIKE:OpenLayers.Filter.Comparison.LIKE,BETWEEN:OpenLayers.Filter.Comparison.BETWEEN},e={},f={AND:OpenLayers.Filter.Logical.AND,OR:OpenLayers.Filter.Logical.OR},g={},h={RPAREN:3,LOGICAL:2,COMPARISON:1},i;for(i in d)d.hasOwnProperty(i)&&(e[d[i]]=i);for(i in f)f.hasOwnProperty(i)&&(g[f[i]]=i);return OpenLayers.Class(OpenLayers.Format,{read:function(d){var e=d,d=[],f,g=["NOT","GEOMETRY","SPATIAL","PROPERTY","LPAREN"];do{a:{f=g;for(var h=void 0,g=void 0,i=f.length,h=0;h<i;h++){var g=f[h],p=b[g]instanceof RegExp?b[g].exec(e):(0,b[g])(e);if(p){f=p[0];e=e.substr(f.length).replace(/^\s*/,"");f={type:g,text:f,remainder:e};break a}}d="ERROR: In parsing: ["+e+"], expected one of: ";for(h=0;h<i;h++)g=f[h],d+="\n "+g+": "+b[g];throw Error(d)}e=f.remainder;g=c[f.type];if("END"!=f.type&&!g)throw Error("No follows list for "+f.type);d.push(f)}while("END"!=f.type);d=a(d);this.keepData&&(this.data=d);return d},write:function(a){if(a instanceof OpenLayers.Geometry)return a.toString();switch(a.CLASS_NAME){case"OpenLayers.Filter.Spatial":switch(a.type){case OpenLayers.Filter.Spatial.BBOX:return"BBOX("+a.property+","+a.value.toBBOX()+")";case OpenLayers.Filter.Spatial.DWITHIN:return"DWITHIN("+a.property+", "+this.write(a.value)+", "+a.distance+")";case OpenLayers.Filter.Spatial.WITHIN:return"WITHIN("+a.property+", "+this.write(a.value)+")";case OpenLayers.Filter.Spatial.INTERSECTS:return"INTERSECTS("+a.property+", "+this.write(a.value)+")";case OpenLayers.Filter.Spatial.CONTAINS:return"CONTAINS("+a.property+", "+this.write(a.value)+")";default:throw Error("Unknown spatial filter type: "+a.type)}case"OpenLayers.Filter.Logical":if(a.type==OpenLayers.Filter.Logical.NOT)return"NOT ("+this.write(a.filters[0])+")";for(var b="(",c=!0,d=0;d<a.filters.length;d++)c?c=!1:b+=") "+g[a.type]+" (",b+=this.write(a.filters[d]);return b+")";case"OpenLayers.Filter.Comparison":return a.type==OpenLayers.Filter.Comparison.BETWEEN?a.property+" BETWEEN "+this.write(a.lowerBoundary)+" AND "+this.write(a.upperBoundary):a.property+" "+e[a.type]+" "+this.write(a.value);case void 0:if("string"===typeof a)return"'"+a+"'";if("number"===typeof a)return""+a;default:throw Error("Can't encode: "+a.CLASS_NAME+" "+a)}},CLASS_NAME:"OpenLayers.Format.CQL"})}();OpenLayers.Control.Split=OpenLayers.Class(OpenLayers.Control,{layer:null,source:null,sourceOptions:null,tolerance:null,edge:!0,deferDelete:!1,mutual:!0,targetFilter:null,sourceFilter:null,handler:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.options=a||{};this.options.source&&this.setSource(this.options.source)},setSource:function(a){this.active?(this.deactivate(),this.handler&&(this.handler.destroy(),delete this.handler),this.source=a,this.activate()):this.source=a},activate:function(){var a=OpenLayers.Control.prototype.activate.call(this);if(a)if(this.source){if(this.source.events)this.source.events.on({sketchcomplete:this.onSketchComplete,afterfeaturemodified:this.afterFeatureModified,scope:this})}else this.handler||(this.handler=new OpenLayers.Handler.Path(this,{done:function(a){this.onSketchComplete({feature:new OpenLayers.Feature.Vector(a)})}},{layerOptions:this.sourceOptions})),this.handler.activate();return a},deactivate:function(){var a=OpenLayers.Control.prototype.deactivate.call(this);a&&this.source&&this.source.events&&this.layer.events.un({sketchcomplete:this.onSketchComplete,afterfeaturemodified:this.afterFeatureModified,scope:this});return a},onSketchComplete:function(a){this.feature=null;return!this.considerSplit(a.feature)},afterFeatureModified:function(a){a.modified&&"function"===typeof a.feature.geometry.split&&(this.feature=a.feature,this.considerSplit(a.feature))},removeByGeometry:function(a,b){for(var c=0,d=a.length;c<d;++c)if(a[c].geometry===b){a.splice(c,1);break}},isEligible:function(a){return a.geometry?a.state!==OpenLayers.State.DELETE&&"function"===typeof a.geometry.split&&this.feature!==a&&(!this.targetFilter||this.targetFilter.evaluate(a.attributes)):!1},considerSplit:function(a){var b=!1,c=!1;if(!this.sourceFilter||this.sourceFilter.evaluate(a.attributes)){for(var d=this.layer&&this.layer.features||[],e,f,g=[],h=[],i=this.layer===this.source&&this.mutual,j={edge:this.edge,tolerance:this.tolerance,mutual:i},k=[a.geometry],l,m,n,o=0,p=d.length;o<p;++o)if(l=d[o],this.isEligible(l)){m=[l.geometry];for(var q=0;q<k.length;++q){n=k[q];for(var r=0;r<m.length;++r)if(e=m[r],n.getBounds().intersectsBounds(e.getBounds())&&(e=n.split(e,j)))if(f=this.events.triggerEvent("beforesplit",{source:a,target:l}),!1!==f&&(i&&(f=e[0],1<f.length&&(f.unshift(q,1),Array.prototype.splice.apply(k,f),q+=f.length-3),e=e[1]),1<e.length))e.unshift(r,1),Array.prototype.splice.apply(m,e),r+=e.length-3}m&&1<m.length&&(this.geomsToFeatures(l,m),this.events.triggerEvent("split",{original:l,features:m}),Array.prototype.push.apply(g,m),h.push(l),c=!0)}k&&1<k.length&&(this.geomsToFeatures(a,k),this.events.triggerEvent("split",{original:a,features:k}),Array.prototype.push.apply(g,k),h.push(a),b=!0);if(b||c){if(this.deferDelete){d=[];o=0;for(p=h.length;o<p;++o)c=h[o],c.state===OpenLayers.State.INSERT?d.push(c):(c.state=OpenLayers.State.DELETE,this.layer.drawFeature(c));this.layer.destroyFeatures(d,{silent:!0});o=0;for(p=g.length;o<p;++o)g[o].state=OpenLayers.State.INSERT}else this.layer.destroyFeatures(h,{silent:!0});this.layer.addFeatures(g,{silent:!0});this.events.triggerEvent("aftersplit",{source:a,features:g})}}return b},geomsToFeatures:function(a,b){var c=a.clone();delete c.geometry;for(var d,e=0,f=b.length;e<f;++e)d=c.clone(),d.geometry=b[e],d.state=OpenLayers.State.INSERT,b[e]=d},destroy:function(){this.active&&this.deactivate();OpenLayers.Control.prototype.destroy.call(this)},CLASS_NAME:"OpenLayers.Control.Split"});OpenLayers.Layer.WMTS=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:!0,version:"1.0.0",requestEncoding:"KVP",url:null,layer:null,matrixSet:null,style:null,format:"image/jpeg",tileOrigin:null,tileFullExtent:null,formatSuffix:null,matrixIds:null,dimensions:null,params:null,zoomOffset:0,serverResolutions:null,formatSuffixMap:{"image/png":"png","image/png8":"png","image/png24":"png","image/png32":"png",png:"png","image/jpeg":"jpg","image/jpg":"jpg",jpeg:"jpg",jpg:"jpg"},matrix:null,initialize:function(a){var b={url:!0,layer:!0,style:!0,matrixSet:!0},c;for(c in b)if(!(c in a))throw Error("Missing property '"+c+"' in layer configuration.");a.params=OpenLayers.Util.upperCaseObject(a.params);OpenLayers.Layer.Grid.prototype.initialize.apply(this,[a.name,a.url,a.params,a]);this.formatSuffix||(this.formatSuffix=this.formatSuffixMap[this.format]||this.format.split("/").pop());if(this.matrixIds&&(a=this.matrixIds.length)&&"string"===typeof this.matrixIds[0]){b=this.matrixIds;this.matrixIds=Array(a);for(c=0;c<a;++c)this.matrixIds[c]={identifier:b[c]}}},setMap:function(){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);this.updateMatrixProperties()},updateMatrixProperties:function(){if(this.matrix=this.getMatrix())if(this.matrix.topLeftCorner&&(this.tileOrigin=this.matrix.topLeftCorner),this.matrix.tileWidth&&this.matrix.tileHeight&&(this.tileSize=new OpenLayers.Size(this.matrix.tileWidth,this.matrix.tileHeight)),this.tileOrigin||(this.tileOrigin=new OpenLayers.LonLat(this.maxExtent.left,this.maxExtent.top)),!this.tileFullExtent)this.tileFullExtent=this.maxExtent},moveTo:function(a,b,c){(b||!this.matrix)&&this.updateMatrixProperties();return OpenLayers.Layer.Grid.prototype.moveTo.apply(this,arguments)},clone:function(a){null==a&&(a=new OpenLayers.Layer.WMTS(this.options));return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a])},getIdentifier:function(){return this.getServerZoom()},getMatrix:function(){var a;if(!this.matrixIds||0===this.matrixIds.length)a={identifier:this.getIdentifier()};else if("scaleDenominator"in this.matrixIds[0])for(var b=OpenLayers.METERS_PER_INCH*OpenLayers.INCHES_PER_UNIT[this.units]*this.getServerResolution()/28e-5,c=Number.POSITIVE_INFINITY,d,e=0,f=this.matrixIds.length;e<f;++e)d=Math.abs(1-this.matrixIds[e].scaleDenominator/b),d<c&&(c=d,a=this.matrixIds[e]);else a=this.matrixIds[this.getIdentifier()];return a},getTileInfo:function(a){var b=this.getServerResolution(),c=(a.lon-this.tileOrigin.lon)/(b*this.tileSize.w),a=(this.tileOrigin.lat-a.lat)/(b*this.tileSize.h),b=Math.floor(c),d=Math.floor(a);return{col:b,row:d,i:Math.floor((c-b)*this.tileSize.w),j:Math.floor((a-d)*this.tileSize.h)}},getURL:function(a){var a=this.adjustBounds(a),b="";if(!this.tileFullExtent||this.tileFullExtent.intersectsBounds(a)){var c=this.getTileInfo(a.getCenterLonLat()),a=this.dimensions;if("REST"===this.requestEncoding.toUpperCase())if(b=this.params,"string"===typeof this.url&&-1!==this.url.indexOf("{")){var d=this.url.replace(/\{/g,"${"),c={style:this.style,Style:this.style,TileMatrixSet:this.matrixSet,TileMatrix:this.matrix.identifier,TileRow:c.row,TileCol:c.col};if(a){var e,f;for(f=a.length-1;0<=f;--f)e=a[f],c[e]=b[e.toUpperCase()]}b=OpenLayers.String.format(d,c)}else{d=this.version+"/"+this.layer+"/"+this.style+"/";if(a)for(f=0;f<a.length;f++)b[a[f]]&&(d=d+b[a[f]]+"/");d=d+this.matrixSet+"/"+this.matrix.identifier+"/"+c.row+"/"+c.col+"."+this.formatSuffix;b=OpenLayers.Util.isArray(this.url)?this.selectUrl(d,this.url):this.url;b.match(/\/$/)||(b+="/");b+=d}else"KVP"===this.requestEncoding.toUpperCase()&&(b={SERVICE:"WMTS",REQUEST:"GetTile",VERSION:this.version,LAYER:this.layer,STYLE:this.style,TILEMATRIXSET:this.matrixSet,TILEMATRIX:this.matrix.identifier,TILEROW:c.row,TILECOL:c.col,FORMAT:this.format},b=OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,[b]))}return b},mergeNewParams:function(a){if("KVP"===this.requestEncoding.toUpperCase())return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,[OpenLayers.Util.upperCaseObject(a)])},CLASS_NAME:"OpenLayers.Layer.WMTS"});OpenLayers.Protocol.SOS.v1_0_0=OpenLayers.Class(OpenLayers.Protocol,{fois:null,formatOptions:null,initialize:function(a){OpenLayers.Protocol.prototype.initialize.apply(this,[a]);a.format||(this.format=new OpenLayers.Format.SOSGetFeatureOfInterest(this.formatOptions))},destroy:function(){this.options&&!this.options.format&&this.format.destroy();this.format=null;OpenLayers.Protocol.prototype.destroy.apply(this)},read:function(a){a=OpenLayers.Util.extend({},a);OpenLayers.Util.applyDefaults(a,this.options||{});var b=new OpenLayers.Protocol.Response({requestType:"read"}),c=this.format,c=OpenLayers.Format.XML.prototype.write.apply(c,[c.writeNode("sos:GetFeatureOfInterest",{fois:this.fois})]);b.priv=OpenLayers.Request.POST({url:a.url,callback:this.createCallback(this.handleRead,b,a),data:c});return b},handleRead:function(a,b){if(b.callback){var c=a.priv;200<=c.status&&300>c.status?(a.features=this.parseFeatures(c),a.code=OpenLayers.Protocol.Response.SUCCESS):a.code=OpenLayers.Protocol.Response.FAILURE;b.callback.call(b.scope,a)}},parseFeatures:function(a){var b=a.responseXML;if(!b||!b.documentElement)b=a.responseText;return!b||0>=b.length?null:this.format.read(b)},CLASS_NAME:"OpenLayers.Protocol.SOS.v1_0_0"});OpenLayers.Layer.KaMapCache=OpenLayers.Class(OpenLayers.Layer.KaMap,{IMAGE_EXTENSIONS:{jpeg:"jpg",gif:"gif",png:"png",png8:"png",png24:"png",dithered:"png"},DEFAULT_FORMAT:"jpeg",initialize:function(a,b,c,d){OpenLayers.Layer.KaMap.prototype.initialize.apply(this,arguments);this.extension=this.IMAGE_EXTENSIONS[this.params.i.toLowerCase()||this.DEFAULT_FORMAT]},getURL:function(a){var a=this.adjustBounds(a),b=this.map.getResolution(),c=Math.round(1e4*this.map.getScale())/1e4,d=Math.round(a.left/b),a=-Math.round(a.top/b),b=Math.floor(d/this.tileSize.w/this.params.metaTileSize.w)*this.tileSize.w*this.params.metaTileSize.w,e=Math.floor(a/this.tileSize.h/this.params.metaTileSize.h)*this.tileSize.h*this.params.metaTileSize.h,c=["/",this.params.map,"/",c,"/",this.params.g.replace(/\s/g,"_"),"/def/t",e,"/l",b,"/t",a,"l",d,".",this.extension],d=this.url;OpenLayers.Util.isArray(d)&&(d=this.selectUrl(c.join(""),d));return d+c.join("")},CLASS_NAME:"OpenLayers.Layer.KaMapCache"});OpenLayers.Protocol.WFS.v1_1_0=OpenLayers.Class(OpenLayers.Protocol.WFS.v1,{version:"1.1.0",initialize:function(a){OpenLayers.Protocol.WFS.v1.prototype.initialize.apply(this,arguments);this.outputFormat&&!this.readFormat&&("gml2"==this.outputFormat.toLowerCase()?this.readFormat=new OpenLayers.Format.GML.v2({featureType:this.featureType,featureNS:this.featureNS,geometryName:this.geometryName}):"json"==this.outputFormat.toLowerCase()&&(this.readFormat=new OpenLayers.Format.GeoJSON))},CLASS_NAME:"OpenLayers.Protocol.WFS.v1_1_0"});OpenLayers.Format.WMSCapabilities.v1_1_1=OpenLayers.Class(OpenLayers.Format.WMSCapabilities.v1_1,{version:"1.1.1",readers:{wms:OpenLayers.Util.applyDefaults({SRS:function(a,b){b.srs[this.getChildValue(a)]=!0}},OpenLayers.Format.WMSCapabilities.v1_1.prototype.readers.wms)},CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1_1_1"});OpenLayers.Format.WMSCapabilities.v1_1_1_WMSC=OpenLayers.Class(OpenLayers.Format.WMSCapabilities.v1_1_1,{version:"1.1.1",profile:"WMSC",readers:{wms:OpenLayers.Util.applyDefaults({VendorSpecificCapabilities:function(a,b){b.vendorSpecific={tileSets:[]};this.readChildNodes(a,b.vendorSpecific)},TileSet:function(a,b){var c={srs:{},bbox:{},resolutions:[]};this.readChildNodes(a,c);b.tileSets.push(c)},Resolutions:function(a,b){for(var c=this.getChildValue(a).split(" "),d=0,e=c.length;d<e;d++)""!=c[d]&&b.resolutions.push(parseFloat(c[d]))},Width:function(a,b){b.width=parseInt(this.getChildValue(a))},Height:function(a,b){b.height=parseInt(this.getChildValue(a))},Layers:function(a,b){b.layers=this.getChildValue(a)},Styles:function(a,b){b.styles=this.getChildValue(a)}},OpenLayers.Format.WMSCapabilities.v1_1_1.prototype.readers.wms)},CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1_1_1_WMSC"});OpenLayers.Format.WMSCapabilities.v1_1_0=OpenLayers.Class(OpenLayers.Format.WMSCapabilities.v1_1,{version:"1.1.0",readers:{wms:OpenLayers.Util.applyDefaults({SRS:function(a,b){for(var c=this.getChildValue(a).split(/ +/),d=0,e=c.length;d<e;d++)b.srs[c[d]]=!0}},OpenLayers.Format.WMSCapabilities.v1_1.prototype.readers.wms)},CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1_1_0"});OpenLayers.Control.LayerSwitcher=OpenLayers.Class(OpenLayers.Control,{roundedCorner:!1,roundedCornerColor:"darkblue",layerStates:null,layersDiv:null,baseLayersDiv:null,baseLayers:null,dataLbl:null,dataLayersDiv:null,dataLayers:null,minimizeDiv:null,maximizeDiv:null,ascending:!0,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.layerStates=[];this.roundedCorner&&OpenLayers.Console.warn("roundedCorner option is deprecated")},destroy:function(){this.clearLayersArray("base");this.clearLayersArray("data");this.map.events.un({buttonclick:this.onButtonClick,addlayer:this.redraw,changelayer:this.redraw,removelayer:this.redraw,changebaselayer:this.redraw,scope:this});this.events.unregister("buttonclick",this,this.onButtonClick);OpenLayers.Control.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.on({addlayer:this.redraw,changelayer:this.redraw,removelayer:this.redraw,changebaselayer:this.redraw,scope:this});this.outsideViewport?(this.events.attachToElement(this.div),this.events.register("buttonclick",this,this.onButtonClick)):this.map.events.register("buttonclick",this,this.onButtonClick)},draw:function(){OpenLayers.Control.prototype.draw.apply(this);this.loadContents();this.outsideViewport||this.minimizeControl();this.redraw();return this.div},onButtonClick:function(a){a=a.buttonElement;a===this.minimizeDiv?this.minimizeControl():a===this.maximizeDiv?this.maximizeControl():a._layerSwitcher===this.id&&(a["for"]&&(a=document.getElementById(a["for"])),a.disabled||("radio"==a.type?(a.checked=!0,this.map.setBaseLayer(this.map.getLayer(a._layer))):(a.checked=!a.checked,this.updateMap())))},clearLayersArray:function(a){this[a+"LayersDiv"].innerHTML="";this[a+"Layers"]=[]},checkRedraw:function(){var a=!1;if(!this.layerStates.length||this.map.layers.length!=this.layerStates.length)a=!0;else for(var b=0,c=this.layerStates.length;b<c;b++){var d=this.layerStates[b],e=this.map.layers[b];if(d.name!=e.name||d.inRange!=e.inRange||d.id!=e.id||d.visibility!=e.visibility){a=!0;break}}return a},redraw:function(){if(!this.checkRedraw())return this.div;this.clearLayersArray("base");this.clearLayersArray("data");var a=!1,b=!1,c=this.map.layers.length;this.layerStates=Array(c);for(var d=0;d<c;d++){var e=this.map.layers[d];this.layerStates[d]={name:e.name,visibility:e.visibility,inRange:e.inRange,id:e.id}}var f=this.map.layers.slice();this.ascending||f.reverse();d=0;for(c=f.length;d<c;d++){var e=f[d],g=e.isBaseLayer;if(e.displayInLayerSwitcher){g?b=!0:a=!0;var h=g?e==this.map.baseLayer:e.getVisibility(),i=document.createElement("input");i.id=this.id+"_input_"+e.name;i.name=g?this.id+"_baseLayers":e.name;i.type=g?"radio":"checkbox";i.value=e.name;i.checked=h;i.defaultChecked=h;i.className="olButton";i._layer=e.id;i._layerSwitcher=this.id;!g&&!e.inRange&&(i.disabled=!0);h=document.createElement("label");h["for"]=i.id;OpenLayers.Element.addClass(h,"labelSpan olButton");h._layer=e.id;h._layerSwitcher=this.id;!g&&!e.inRange&&(h.style.color="gray");h.innerHTML=e.name;h.style.verticalAlign=g?"bottom":"baseline";var j=document.createElement("br");(g?this.baseLayers:this.dataLayers).push({layer:e,inputElem:i,labelSpan:h});e=g?this.baseLayersDiv:this.dataLayersDiv;e.appendChild(i);e.appendChild(h);e.appendChild(j)}}this.dataLbl.style.display=a?"":"none";this.baseLbl.style.display=b?"":"none";return this.div},updateMap:function(){for(var a=0,b=this.baseLayers.length;a<b;a++){var c=this.baseLayers[a];c.inputElem.checked&&this.map.setBaseLayer(c.layer,!1)}a=0;for(b=this.dataLayers.length;a<b;a++)c=this.dataLayers[a],c.layer.setVisibility(c.inputElem.checked)},maximizeControl:function(a){this.div.style.width="";this.div.style.height="";this.showControls(!1);null!=a&&OpenLayers.Event.stop(a)},minimizeControl:function(a){this.div.style.width="0px";this.div.style.height="0px";this.showControls(!0);null!=a&&OpenLayers.Event.stop(a)},showControls:function(a){this.maximizeDiv.style.display=a?"":"none";this.minimizeDiv.style.display=a?"none":"";this.layersDiv.style.display=a?"none":""},loadContents:function(){this.layersDiv=document.createElement("div");this.layersDiv.id=this.id+"_layersDiv";OpenLayers.Element.addClass(this.layersDiv,"layersDiv");this.baseLbl=document.createElement("div");this.baseLbl.innerHTML=OpenLayers.i18n("Base Layer");OpenLayers.Element.addClass(this.baseLbl,"baseLbl");this.baseLayersDiv=document.createElement("div");OpenLayers.Element.addClass(this.baseLayersDiv,"baseLayersDiv");this.dataLbl=document.createElement("div");this.dataLbl.innerHTML=OpenLayers.i18n("Overlays");OpenLayers.Element.addClass(this.dataLbl,"dataLbl");this.dataLayersDiv=document.createElement("div");OpenLayers.Element.addClass(this.dataLayersDiv,"dataLayersDiv");this.ascending?(this.layersDiv.appendChild(this.baseLbl),this.layersDiv.appendChild(this.baseLayersDiv),this.layersDiv.appendChild(this.dataLbl),this.layersDiv.appendChild(this.dataLayersDiv)):(this.layersDiv.appendChild(this.dataLbl),this.layersDiv.appendChild(this.dataLayersDiv),this.layersDiv.appendChild(this.baseLbl),this.layersDiv.appendChild(this.baseLayersDiv));this.div.appendChild(this.layersDiv);this.roundedCorner&&(OpenLayers.Rico.Corner.round(this.div,{corners:"tl bl",bgColor:"transparent",color:this.roundedCornerColor,blend:!1}),OpenLayers.Rico.Corner.changeOpacity(this.layersDiv,.75));var a=OpenLayers.Util.getImageLocation("layer-switcher-maximize.png");this.maximizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MaximizeDiv",null,null,a,"absolute");OpenLayers.Element.addClass(this.maximizeDiv,"maximizeDiv olButton");this.maximizeDiv.style.display="none";this.div.appendChild(this.maximizeDiv);a=OpenLayers.Util.getImageLocation("layer-switcher-minimize.png");this.minimizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MinimizeDiv",null,null,a,"absolute");OpenLayers.Element.addClass(this.minimizeDiv,"minimizeDiv olButton");this.minimizeDiv.style.display="none";this.div.appendChild(this.minimizeDiv)},CLASS_NAME:"OpenLayers.Control.LayerSwitcher"});OpenLayers.Format.Atom=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{atom:"http://www.w3.org/2005/Atom",georss:"http://www.georss.org/georss"},feedTitle:"untitled",defaultEntryTitle:"untitled",gmlParser:null,xy:!1,read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));return this.parseFeatures(a)},write:function(a){var b;if(OpenLayers.Util.isArray(a)){b=this.createElementNSPlus("atom:feed");b.appendChild(this.createElementNSPlus("atom:title",{value:this.feedTitle
}));for(var c=0,d=a.length;c<d;c++)b.appendChild(this.buildEntryNode(a[c]))}else b=this.buildEntryNode(a);return OpenLayers.Format.XML.prototype.write.apply(this,[b])},buildContentNode:function(a){var b=this.createElementNSPlus("atom:content",{attributes:{type:a.type||null}});if(a.src)b.setAttribute("src",a.src);else if("text"==a.type||null==a.type)b.appendChild(this.createTextNode(a.value));else if("html"==a.type){if("string"!=typeof a.value)throw"HTML content must be in form of an escaped string";b.appendChild(this.createTextNode(a.value))}else"xhtml"==a.type?b.appendChild(a.value):"xhtml"==a.type||a.type.match(/(\+|\/)xml$/)?b.appendChild(a.value):b.appendChild(this.createTextNode(a.value));return b},buildEntryNode:function(a){var b=a.attributes,c=b.atom||{},d=this.createElementNSPlus("atom:entry");if(c.authors)for(var e=OpenLayers.Util.isArray(c.authors)?c.authors:[c.authors],f=0,g=e.length;f<g;f++)d.appendChild(this.buildPersonConstructNode("author",e[f]));if(c.categories)for(var e=OpenLayers.Util.isArray(c.categories)?c.categories:[c.categories],h,f=0,g=e.length;f<g;f++)h=e[f],d.appendChild(this.createElementNSPlus("atom:category",{attributes:{term:h.term,scheme:h.scheme||null,label:h.label||null}}));c.content&&d.appendChild(this.buildContentNode(c.content));if(c.contributors){e=OpenLayers.Util.isArray(c.contributors)?c.contributors:[c.contributors];f=0;for(g=e.length;f<g;f++)d.appendChild(this.buildPersonConstructNode("contributor",e[f]))}a.fid&&d.appendChild(this.createElementNSPlus("atom:id",{value:a.fid}));if(c.links){e=OpenLayers.Util.isArray(c.links)?c.links:[c.links];f=0;for(g=e.length;f<g;f++)h=e[f],d.appendChild(this.createElementNSPlus("atom:link",{attributes:{href:h.href,rel:h.rel||null,type:h.type||null,hreflang:h.hreflang||null,title:h.title||null,length:h.length||null}}))}c.published&&d.appendChild(this.createElementNSPlus("atom:published",{value:c.published}));c.rights&&d.appendChild(this.createElementNSPlus("atom:rights",{value:c.rights}));if(c.summary||b.description)d.appendChild(this.createElementNSPlus("atom:summary",{value:c.summary||b.description}));d.appendChild(this.createElementNSPlus("atom:title",{value:c.title||b.title||this.defaultEntryTitle}));c.updated&&d.appendChild(this.createElementNSPlus("atom:updated",{value:c.updated}));a.geometry&&(b=this.createElementNSPlus("georss:where"),b.appendChild(this.buildGeometryNode(a.geometry)),d.appendChild(b));return d},initGmlParser:function(){this.gmlParser=new OpenLayers.Format.GML.v3({xy:this.xy,featureNS:"http://example.com#feature",internalProjection:this.internalProjection,externalProjection:this.externalProjection})},buildGeometryNode:function(a){this.gmlParser||this.initGmlParser();return this.gmlParser.writeNode("feature:_geometry",a).firstChild},buildPersonConstructNode:function(a,b){var c=["uri","email"],d=this.createElementNSPlus("atom:"+a);d.appendChild(this.createElementNSPlus("atom:name",{value:b.name}));for(var e=0,f=c.length;e<f;e++)b[c[e]]&&d.appendChild(this.createElementNSPlus("atom:"+c[e],{value:b[c[e]]}));return d},getFirstChildValue:function(a,b,c,d){return(a=this.getElementsByTagNameNS(a,b,c))&&0<a.length?this.getChildValue(a[0],d):d},parseFeature:function(a){var b={},c=null,d=null,e=null,f=this.namespaces.atom;this.parsePersonConstructs(a,"author",b);d=this.getElementsByTagNameNS(a,f,"category");0<d.length&&(b.categories=[]);for(var g=0,h=d.length;g<h;g++){c={};c.term=d[g].getAttribute("term");if(e=d[g].getAttribute("scheme"))c.scheme=e;if(e=d[g].getAttribute("label"))c.label=e;b.categories.push(c)}d=this.getElementsByTagNameNS(a,f,"content");if(0<d.length){c={};if(e=d[0].getAttribute("type"))c.type=e;(e=d[0].getAttribute("src"))?c.src=e:(c.value="text"==c.type||"html"==c.type||null==c.type?this.getFirstChildValue(a,f,"content",null):"xhtml"==c.type||c.type.match(/(\+|\/)xml$/)?this.getChildEl(d[0]):this.getFirstChildValue(a,f,"content",null),b.content=c)}this.parsePersonConstructs(a,"contributor",b);b.id=this.getFirstChildValue(a,f,"id",null);d=this.getElementsByTagNameNS(a,f,"link");0<d.length&&(b.links=Array(d.length));for(var i=["rel","type","hreflang","title","length"],g=0,h=d.length;g<h;g++){c={};c.href=d[g].getAttribute("href");for(var j=0,k=i.length;j<k;j++)(e=d[g].getAttribute(i[j]))&&(c[i[j]]=e);b.links[g]=c}if(c=this.getFirstChildValue(a,f,"published",null))b.published=c;if(c=this.getFirstChildValue(a,f,"rights",null))b.rights=c;if(c=this.getFirstChildValue(a,f,"summary",null))b.summary=c;b.title=this.getFirstChildValue(a,f,"title",null);b.updated=this.getFirstChildValue(a,f,"updated",null);c={title:b.title,description:b.summary,atom:b};a=this.parseLocations(a)[0];a=new OpenLayers.Feature.Vector(a,c);a.fid=b.id;return a},parseFeatures:function(a){var b=[],c=this.getElementsByTagNameNS(a,this.namespaces.atom,"entry");0==c.length&&(c=[a]);for(var a=0,d=c.length;a<d;a++)b.push(this.parseFeature(c[a]));return b},parseLocations:function(a){var b=this.namespaces.georss,c={components:[]},d=this.getElementsByTagNameNS(a,b,"where");if(d&&0<d.length){this.gmlParser||this.initGmlParser();for(var e=0,f=d.length;e<f;e++)this.gmlParser.readChildNodes(d[e],c)}c=c.components;if((d=this.getElementsByTagNameNS(a,b,"point"))&&0<d.length){e=0;for(f=d.length;e<f;e++){var g=OpenLayers.String.trim(d[e].firstChild.nodeValue).split(/\s+/);2!=g.length&&(g=OpenLayers.String.trim(d[e].firstChild.nodeValue).split(/\s*,\s*/));c.push(new OpenLayers.Geometry.Point(g[1],g[0]))}}var h=this.getElementsByTagNameNS(a,b,"line");if(h&&0<h.length)for(var i,e=0,f=h.length;e<f;e++){d=OpenLayers.String.trim(h[e].firstChild.nodeValue).split(/\s+/);i=[];for(var j=0,k=d.length;j<k;j+=2)g=new OpenLayers.Geometry.Point(d[j+1],d[j]),i.push(g);c.push(new OpenLayers.Geometry.LineString(i))}if((a=this.getElementsByTagNameNS(a,b,"polygon"))&&0<a.length){e=0;for(f=a.length;e<f;e++){d=OpenLayers.String.trim(a[e].firstChild.nodeValue).split(/\s+/);i=[];j=0;for(k=d.length;j<k;j+=2)g=new OpenLayers.Geometry.Point(d[j+1],d[j]),i.push(g);c.push(new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing(c)]))}}if(this.internalProjection&&this.externalProjection){e=0;for(f=c.length;e<f;e++)c[e]&&c[e].transform(this.externalProjection,this.internalProjection)}return c},parsePersonConstructs:function(a,b,c){for(var d=[],e=this.namespaces.atom,a=this.getElementsByTagNameNS(a,e,b),f=["uri","email"],g=0,h=a.length;g<h;g++){var i={};i.name=this.getFirstChildValue(a[g],e,"name",null);for(var j=0,k=f.length;j<k;j++){var l=this.getFirstChildValue(a[g],e,f[j],null);l&&(i[f[j]]=l)}d.push(i)}0<d.length&&(c[b+"s"]=d)},CLASS_NAME:"OpenLayers.Format.Atom"});OpenLayers.Control.KeyboardDefaults=OpenLayers.Class(OpenLayers.Control,{autoActivate:!0,slideFactor:75,observeElement:null,draw:function(){this.handler=new OpenLayers.Handler.Keyboard(this,{keydown:this.defaultKeyPress},{observeElement:this.observeElement||document})},defaultKeyPress:function(a){var b,c=!0;switch(a.keyCode){case OpenLayers.Event.KEY_LEFT:this.map.pan(-this.slideFactor,0);break;case OpenLayers.Event.KEY_RIGHT:this.map.pan(this.slideFactor,0);break;case OpenLayers.Event.KEY_UP:this.map.pan(0,-this.slideFactor);break;case OpenLayers.Event.KEY_DOWN:this.map.pan(0,this.slideFactor);break;case 33:b=this.map.getSize();this.map.pan(0,-.75*b.h);break;case 34:b=this.map.getSize();this.map.pan(0,.75*b.h);break;case 35:b=this.map.getSize();this.map.pan(.75*b.w,0);break;case 36:b=this.map.getSize();this.map.pan(-.75*b.w,0);break;case 43:case 61:case 187:case 107:this.map.zoomIn();break;case 45:case 109:case 189:case 95:this.map.zoomOut();break;default:c=!1}c&&OpenLayers.Event.stop(a)},CLASS_NAME:"OpenLayers.Control.KeyboardDefaults"});OpenLayers.Format.WMTSCapabilities.v1_0_0=OpenLayers.Class(OpenLayers.Format.OWSCommon.v1_1_0,{version:"1.0.0",namespaces:{ows:"http://www.opengis.net/ows/1.1",wmts:"http://www.opengis.net/wmts/1.0",xlink:"http://www.w3.org/1999/xlink"},yx:null,defaultPrefix:"wmts",initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a]);this.options=a;a=OpenLayers.Util.extend({},OpenLayers.Format.WMTSCapabilities.prototype.yx);this.yx=OpenLayers.Util.extend(a,this.yx)},read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a&&9==a.nodeType&&(a=a.documentElement);var b={};this.readNode(a,b);b.version=this.version;return b},readers:{wmts:{Capabilities:function(a,b){this.readChildNodes(a,b)},Contents:function(a,b){b.contents={};b.contents.layers=[];b.contents.tileMatrixSets={};this.readChildNodes(a,b.contents)},Layer:function(a,b){var c={styles:[],formats:[],dimensions:[],tileMatrixSetLinks:[],layers:[]};this.readChildNodes(a,c);b.layers.push(c)},Style:function(a,b){var c={};c.isDefault="true"===a.getAttribute("isDefault");this.readChildNodes(a,c);b.styles.push(c)},Format:function(a,b){b.formats.push(this.getChildValue(a))},TileMatrixSetLink:function(a,b){var c={};this.readChildNodes(a,c);b.tileMatrixSetLinks.push(c)},TileMatrixSet:function(a,b){if(b.layers){var c={matrixIds:[]};this.readChildNodes(a,c);b.tileMatrixSets[c.identifier]=c}else b.tileMatrixSet=this.getChildValue(a)},TileMatrix:function(a,b){var c={supportedCRS:b.supportedCRS};this.readChildNodes(a,c);b.matrixIds.push(c)},ScaleDenominator:function(a,b){b.scaleDenominator=parseFloat(this.getChildValue(a))},TopLeftCorner:function(a,b){var c=this.getChildValue(a).split(" "),d;b.supportedCRS&&(d=!!this.yx[b.supportedCRS.replace(/urn:ogc:def:crs:(\w+):.+:(\w+)$/,"urn:ogc:def:crs:$1::$2")]);b.topLeftCorner=d?new OpenLayers.LonLat(c[1],c[0]):new OpenLayers.LonLat(c[0],c[1])},TileWidth:function(a,b){b.tileWidth=parseInt(this.getChildValue(a))},TileHeight:function(a,b){b.tileHeight=parseInt(this.getChildValue(a))},MatrixWidth:function(a,b){b.matrixWidth=parseInt(this.getChildValue(a))},MatrixHeight:function(a,b){b.matrixHeight=parseInt(this.getChildValue(a))},ResourceURL:function(a,b){b.resourceUrl=b.resourceUrl||{};b.resourceUrl[a.getAttribute("resourceType")]={format:a.getAttribute("format"),template:a.getAttribute("template")}},WSDL:function(a,b){b.wsdl={};b.wsdl.href=a.getAttribute("xlink:href")},ServiceMetadataURL:function(a,b){b.serviceMetadataUrl={};b.serviceMetadataUrl.href=a.getAttribute("xlink:href")},LegendURL:function(a,b){b.legend={};b.legend.href=a.getAttribute("xlink:href");b.legend.format=a.getAttribute("format")},Dimension:function(a,b){var c={values:[]};this.readChildNodes(a,c);b.dimensions.push(c)},Default:function(a,b){b["default"]=this.getChildValue(a)},Value:function(a,b){b.values.push(this.getChildValue(a))}},ows:OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers.ows},CLASS_NAME:"OpenLayers.Format.WMTSCapabilities.v1_0_0"});(function(undefined){var moment,VERSION="1.7.2",round=Math.round,i,languages={},currentLanguage="en",hasModule=typeof module!=="undefined"&&module.exports,langConfigProperties="months|monthsShort|weekdays|weekdaysShort|weekdaysMin|longDateFormat|calendar|relativeTime|ordinal|meridiem".split("|"),aspNetJsonRegex=/^\/?Date\((\-?\d+)/i,formattingTokens=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|SS?S?|zz?|ZZ?|.)/g,localFormattingTokens=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?)/g,parseMultipleFormatChunker=/([0-9a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)/gi,parseTokenOneOrTwoDigits=/\d\d?/,parseTokenOneToThreeDigits=/\d{1,3}/,parseTokenThreeDigits=/\d{3}/,parseTokenFourDigits=/\d{1,4}/,parseTokenWord=/[0-9a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+/i,parseTokenTimezone=/Z|[\+\-]\d\d:?\d\d/i,parseTokenT=/T/i,isoRegex=/^\s*\d{4}-\d\d-\d\d(T(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,isoFormat="YYYY-MM-DDTHH:mm:ssZ",isoTimes=[["HH:mm:ss.S",/T\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/T\d\d:\d\d:\d\d/],["HH:mm",/T\d\d:\d\d/],["HH",/T\d\d/]],parseTimezoneChunker=/([\+\-]|\d\d)/gi,proxyGettersAndSetters="Month|Date|Hours|Minutes|Seconds|Milliseconds".split("|"),unitMillisecondFactors={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},formatFunctions={},ordinalizeTokens="DDD w M D d".split(" "),paddedTokens="M D H h m s w".split(" "),formatTokenFunctions={M:function(){return this.month()+1},MMM:function(format){return getValueFromArray("monthsShort",this.month(),this,format)},MMMM:function(format){return getValueFromArray("months",this.month(),this,format)},D:function(){return this.date()},DDD:function(){var a=new Date(this.year(),this.month(),this.date()),b=new Date(this.year(),0,1);return~~((a-b)/864e5+1.5)},d:function(){return this.day()},dd:function(format){return getValueFromArray("weekdaysMin",this.day(),this,format)},ddd:function(format){return getValueFromArray("weekdaysShort",this.day(),this,format)},dddd:function(format){return getValueFromArray("weekdays",this.day(),this,format)},w:function(){var a=new Date(this.year(),this.month(),this.date()-this.day()+5),b=new Date(a.getFullYear(),0,4);return~~((a-b)/864e5/7+1.5)},YY:function(){return leftZeroFill(this.year()%100,2)},YYYY:function(){return leftZeroFill(this.year(),4)},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),true)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),false)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return leftZeroFill(~~(this.milliseconds()/10),2)},SSS:function(){return leftZeroFill(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";if(a<0){a=-a;b="-"}return b+leftZeroFill(~~(a/60),2)+":"+leftZeroFill(~~a%60,2)},ZZ:function(){var a=-this.zone(),b="+";if(a<0){a=-a;b="-"}return b+leftZeroFill(~~(10*a/6),4)}};function getValueFromArray(key,index,m,format){var lang=m.lang();return lang[key].call?lang[key](m,format):lang[key][index]}function padToken(func,count){return function(a){return leftZeroFill(func.call(this,a),count)}}function ordinalizeToken(func){return function(a){var b=func.call(this,a);return b+this.lang().ordinal(b)}}while(ordinalizeTokens.length){i=ordinalizeTokens.pop();formatTokenFunctions[i+"o"]=ordinalizeToken(formatTokenFunctions[i])}while(paddedTokens.length){i=paddedTokens.pop();formatTokenFunctions[i+i]=padToken(formatTokenFunctions[i],2)}formatTokenFunctions.DDDD=padToken(formatTokenFunctions.DDD,3);function Moment(date,isUTC,lang){this._d=date;this._isUTC=!!isUTC;this._a=date._a||null;this._lang=lang||false}function Duration(duration){var data=this._data={},years=duration.years||duration.y||0,months=duration.months||duration.M||0,weeks=duration.weeks||duration.w||0,days=duration.days||duration.d||0,hours=duration.hours||duration.h||0,minutes=duration.minutes||duration.m||0,seconds=duration.seconds||duration.s||0,milliseconds=duration.milliseconds||duration.ms||0;this._milliseconds=milliseconds+seconds*1e3+minutes*6e4+hours*36e5;this._days=days+weeks*7;this._months=months+years*12;data.milliseconds=milliseconds%1e3;seconds+=absRound(milliseconds/1e3);data.seconds=seconds%60;minutes+=absRound(seconds/60);data.minutes=minutes%60;hours+=absRound(minutes/60);data.hours=hours%24;days+=absRound(hours/24);days+=weeks*7;data.days=days%30;months+=absRound(days/30);data.months=months%12;years+=absRound(months/12);data.years=years;this._lang=false}function absRound(number){if(number<0){return Math.ceil(number)}else{return Math.floor(number)}}function leftZeroFill(number,targetLength){var output=number+"";while(output.length<targetLength){output="0"+output}return output}function addOrSubtractDurationFromMoment(mom,duration,isAdding){var ms=duration._milliseconds,d=duration._days,M=duration._months,currentDate;if(ms){mom._d.setTime(+mom+ms*isAdding)}if(d){mom.date(mom.date()+d*isAdding)}if(M){currentDate=mom.date();mom.date(1).month(mom.month()+M*isAdding).date(Math.min(currentDate,mom.daysInMonth()))}}function isArray(input){return Object.prototype.toString.call(input)==="[object Array]"}function compareArrays(array1,array2){var len=Math.min(array1.length,array2.length),lengthDiff=Math.abs(array1.length-array2.length),diffs=0,i;for(i=0;i<len;i++){if(~~array1[i]!==~~array2[i]){diffs++}}return diffs+lengthDiff}function dateFromArray(input,asUTC,hoursOffset,minutesOffset){var i,date,forValid=[];for(i=0;i<7;i++){forValid[i]=input[i]=input[i]==null?i===2?1:0:input[i]}input[7]=forValid[7]=asUTC;if(input[8]!=null){forValid[8]=input[8]}input[3]+=hoursOffset||0;input[4]+=minutesOffset||0;date=new Date(0);if(asUTC){date.setUTCFullYear(input[0],input[1],input[2]);date.setUTCHours(input[3],input[4],input[5],input[6])}else{date.setFullYear(input[0],input[1],input[2]);date.setHours(input[3],input[4],input[5],input[6])}date._a=forValid;return date}function loadLang(key,values){var i,m,parse=[];if(!values&&hasModule){values=require("./lang/"+key)}for(i=0;i<langConfigProperties.length;i++){values[langConfigProperties[i]]=values[langConfigProperties[i]]||languages.en[langConfigProperties[i]]}for(i=0;i<12;i++){m=moment([2e3,i]);parse[i]=new RegExp("^"+(values.months[i]||values.months(m,""))+"|^"+(values.monthsShort[i]||values.monthsShort(m,"")).replace(".",""),"i")}values.monthsParse=values.monthsParse||parse;languages[key]=values;return values}function getLangDefinition(m){var langKey=typeof m==="string"&&m||m&&m._lang||null;return langKey?languages[langKey]||loadLang(langKey):moment}function removeFormattingTokens(input){if(input.match(/\[.*\]/)){return input.replace(/^\[|\]$/g,"")}return input.replace(/\\/g,"")}function makeFormatFunction(format){var array=format.match(formattingTokens),i,length;for(i=0,length=array.length;i<length;i++){if(formatTokenFunctions[array[i]]){array[i]=formatTokenFunctions[array[i]]}else{array[i]=removeFormattingTokens(array[i])}}return function(mom){var output="";for(i=0;i<length;i++){output+=typeof array[i].call==="function"?array[i].call(mom,format):array[i]}return output}}function formatMoment(m,format){var i=5;function replaceLongDateFormatTokens(input){return m.lang().longDateFormat[input]||input}while(i--&&localFormattingTokens.test(format)){format=format.replace(localFormattingTokens,replaceLongDateFormatTokens)}if(!formatFunctions[format]){formatFunctions[format]=makeFormatFunction(format)}return formatFunctions[format](m)}function getParseRegexForToken(token){switch(token){case"DDDD":return parseTokenThreeDigits;case"YYYY":return parseTokenFourDigits;case"S":case"SS":case"SSS":case"DDD":return parseTokenOneToThreeDigits;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":case"a":case"A":return parseTokenWord;case"Z":case"ZZ":return parseTokenTimezone;case"T":return parseTokenT;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return parseTokenOneOrTwoDigits;default:return new RegExp(token.replace("\\",""))}}function addTimeToArrayFromToken(token,input,datePartArray,config){var a,b;switch(token){case"M":case"MM":datePartArray[1]=input==null?0:~~input-1;break;case"MMM":case"MMMM":for(a=0;a<12;a++){if(getLangDefinition().monthsParse[a].test(input)){datePartArray[1]=a;b=true;break}}if(!b){datePartArray[8]=false}break;case"D":case"DD":case"DDD":case"DDDD":if(input!=null){datePartArray[2]=~~input}break;case"YY":datePartArray[0]=~~input+(~~input>70?1900:2e3);break;case"YYYY":datePartArray[0]=~~Math.abs(input);break;case"a":case"A":config.isPm=(input+"").toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":datePartArray[3]=~~input;break;case"m":case"mm":datePartArray[4]=~~input;break;case"s":case"ss":datePartArray[5]=~~input;break;case"S":case"SS":case"SSS":datePartArray[6]=~~(("0."+input)*1e3);break;case"Z":case"ZZ":config.isUTC=true;a=(input+"").match(parseTimezoneChunker);if(a&&a[1]){config.tzh=~~a[1]}if(a&&a[2]){config.tzm=~~a[2]}if(a&&a[0]==="+"){config.tzh=-config.tzh;config.tzm=-config.tzm}break}if(input==null){datePartArray[8]=false}}function makeDateFromStringAndFormat(string,format){var datePartArray=[0,0,1,0,0,0,0],config={tzh:0,tzm:0},tokens=format.match(formattingTokens),i,parsedInput;for(i=0;i<tokens.length;i++){parsedInput=(getParseRegexForToken(tokens[i]).exec(string)||[])[0];if(parsedInput){string=string.slice(string.indexOf(parsedInput)+parsedInput.length)}if(formatTokenFunctions[tokens[i]]){addTimeToArrayFromToken(tokens[i],parsedInput,datePartArray,config)}}if(config.isPm&&datePartArray[3]<12){datePartArray[3]+=12}if(config.isPm===false&&datePartArray[3]===12){datePartArray[3]=0}return dateFromArray(datePartArray,config.isUTC,config.tzh,config.tzm)}function makeDateFromStringAndArray(string,formats){var output,inputParts=string.match(parseMultipleFormatChunker)||[],formattedInputParts,scoreToBeat=99,i,currentDate,currentScore;for(i=0;i<formats.length;i++){currentDate=makeDateFromStringAndFormat(string,formats[i]);formattedInputParts=formatMoment(new Moment(currentDate),formats[i]).match(parseMultipleFormatChunker)||[];currentScore=compareArrays(inputParts,formattedInputParts);if(currentScore<scoreToBeat){scoreToBeat=currentScore;output=currentDate}}return output}function makeDateFromString(string){var format="YYYY-MM-DDT",i;if(isoRegex.exec(string)){for(i=0;i<4;i++){if(isoTimes[i][1].exec(string)){format+=isoTimes[i][0];break}}return parseTokenTimezone.exec(string)?makeDateFromStringAndFormat(string,format+" Z"):makeDateFromStringAndFormat(string,format)}return new Date(string)}function substituteTimeAgo(string,number,withoutSuffix,isFuture,lang){var rt=lang.relativeTime[string];return typeof rt==="function"?rt(number||1,!!withoutSuffix,string,isFuture):rt.replace(/%d/i,number||1)}function relativeTime(milliseconds,withoutSuffix,lang){var seconds=round(Math.abs(milliseconds)/1e3),minutes=round(seconds/60),hours=round(minutes/60),days=round(hours/24),years=round(days/365),args=seconds<45&&["s",seconds]||minutes===1&&["m"]||minutes<45&&["mm",minutes]||hours===1&&["h"]||hours<22&&["hh",hours]||days===1&&["d"]||days<=25&&["dd",days]||days<=45&&["M"]||days<345&&["MM",round(days/30)]||years===1&&["y"]||["yy",years];args[2]=withoutSuffix;args[3]=milliseconds>0;args[4]=lang;return substituteTimeAgo.apply({},args)}moment=function(input,format){if(input===null||input===""){return null}var date,matched;if(moment.isMoment(input)){return new Moment(new Date(+input._d),input._isUTC,input._lang)}else if(format){if(isArray(format)){date=makeDateFromStringAndArray(input,format)}else{date=makeDateFromStringAndFormat(input,format)}}else{matched=aspNetJsonRegex.exec(input);date=input===undefined?new Date:matched?new Date(+matched[1]):input instanceof Date?input:isArray(input)?dateFromArray(input):typeof input==="string"?makeDateFromString(input):new Date(input)}return new Moment(date)};moment.utc=function(input,format){if(isArray(input)){return new Moment(dateFromArray(input,true),true)}if(typeof input==="string"&&!parseTokenTimezone.exec(input)){input+=" +0000";if(format){format+=" Z"}}return moment(input,format).utc()};moment.unix=function(input){return moment(input*1e3)};moment.duration=function(input,key){var isDuration=moment.isDuration(input),isNumber=typeof input==="number",duration=isDuration?input._data:isNumber?{}:input,ret;if(isNumber){if(key){duration[key]=input}else{duration.milliseconds=input}}ret=new Duration(duration);if(isDuration){ret._lang=input._lang}return ret};moment.humanizeDuration=function(num,type,withSuffix){return moment.duration(num,type===true?null:type).humanize(type===true?true:withSuffix)};moment.version=VERSION;moment.defaultFormat=isoFormat;moment.lang=function(key,values){var i;if(!key){return currentLanguage}if(values||!languages[key]){loadLang(key,values)}if(languages[key]){for(i=0;i<langConfigProperties.length;i++){moment[langConfigProperties[i]]=languages[key][langConfigProperties[i]]}moment.monthsParse=languages[key].monthsParse;currentLanguage=key}};moment.langData=getLangDefinition;moment.isMoment=function(obj){return obj instanceof Moment};moment.isDuration=function(obj){return obj instanceof Duration};moment.lang("en",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},meridiem:function(hours,minutes,isLower){if(hours>11){return isLower?"pm":"PM"}else{return isLower?"am":"AM"}},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(number){var b=number%10;return~~(number%100/10)===1?"th":b===1?"st":b===2?"nd":b===3?"rd":"th"}});moment.fn=Moment.prototype={clone:function(){return moment(this)},valueOf:function(){return+this._d},unix:function(){return Math.floor(+this._d/1e3)},toString:function(){return this._d.toString()},toDate:function(){return this._d},toArray:function(){var m=this;return[m.year(),m.month(),m.date(),m.hours(),m.minutes(),m.seconds(),m.milliseconds(),!!this._isUTC]},isValid:function(){if(this._a){if(this._a[8]!=null){return!!this._a[8]}return!compareArrays(this._a,(this._a[7]?moment.utc(this._a):moment(this._a)).toArray())}return!isNaN(this._d.getTime())},utc:function(){this._isUTC=true;return this},local:function(){this._isUTC=false;return this},format:function(inputString){return formatMoment(this,inputString?inputString:moment.defaultFormat)},add:function(input,val){var dur=val?moment.duration(+val,input):moment.duration(input);addOrSubtractDurationFromMoment(this,dur,1);return this},subtract:function(input,val){var dur=val?moment.duration(+val,input):moment.duration(input);addOrSubtractDurationFromMoment(this,dur,-1);return this},diff:function(input,val,asFloat){var inputMoment=this._isUTC?moment(input).utc():moment(input).local(),zoneDiff=(this.zone()-inputMoment.zone())*6e4,diff=this._d-inputMoment._d-zoneDiff,year=this.year()-inputMoment.year(),month=this.month()-inputMoment.month(),date=this.date()-inputMoment.date(),output;if(val==="months"){output=year*12+month+date/30}else if(val==="years"){output=year+(month+date/30)/12}else{output=val==="seconds"?diff/1e3:val==="minutes"?diff/6e4:val==="hours"?diff/36e5:val==="days"?diff/864e5:val==="weeks"?diff/6048e5:diff}return asFloat?output:round(output)},from:function(time,withoutSuffix){return moment.duration(this.diff(time)).lang(this._lang).humanize(!withoutSuffix)},fromNow:function(withoutSuffix){return this.from(moment(),withoutSuffix)},calendar:function(){var diff=this.diff(moment().sod(),"days",true),calendar=this.lang().calendar,allElse=calendar.sameElse,format=diff<-6?allElse:diff<-1?calendar.lastWeek:diff<0?calendar.lastDay:diff<1?calendar.sameDay:diff<2?calendar.nextDay:diff<7?calendar.nextWeek:allElse;return this.format(typeof format==="function"?format.apply(this):format)},isLeapYear:function(){var year=this.year();return year%4===0&&year%100!==0||year%400===0},isDST:function(){return this.zone()<moment([this.year()]).zone()||this.zone()<moment([this.year(),5]).zone()},day:function(input){var day=this._isUTC?this._d.getUTCDay():this._d.getDay();return input==null?day:this.add({d:input-day})},startOf:function(val){switch(val.replace(/s$/,"")){case"year":this.month(0);case"month":this.date(1);case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return this},endOf:function(val){return this.startOf(val).add(val.replace(/s?$/,"s"),1).subtract("ms",1)},sod:function(){return this.clone().startOf("day")},eod:function(){return this.clone().endOf("day")},zone:function(){return this._isUTC?0:this._d.getTimezoneOffset()},daysInMonth:function(){return moment.utc([this.year(),this.month()+1,0]).date()},lang:function(lang){if(lang===undefined){return getLangDefinition(this)}else{this._lang=lang;return this}}};function makeGetterAndSetter(name,key){moment.fn[name]=function(input){var utc=this._isUTC?"UTC":"";if(input!=null){this._d["set"+utc+key](input);return this}else{return this._d["get"+utc+key]()}}}for(i=0;i<proxyGettersAndSetters.length;i++){makeGetterAndSetter(proxyGettersAndSetters[i].toLowerCase(),proxyGettersAndSetters[i])}makeGetterAndSetter("year","FullYear");moment.duration.fn=Duration.prototype={weeks:function(){return absRound(this.days()/7)},valueOf:function(){return this._milliseconds+this._days*864e5+this._months*2592e6},humanize:function(withSuffix){var difference=+this,rel=this.lang().relativeTime,output=relativeTime(difference,!withSuffix,this.lang()),fromNow=difference<=0?rel.past:rel.future;if(withSuffix){if(typeof fromNow==="function"){output=fromNow(output)}else{output=fromNow.replace(/%s/i,output)}}return output},lang:moment.fn.lang};function makeDurationGetter(name){moment.duration.fn[name]=function(){return this._data[name]}}function makeDurationAsGetter(name,factor){moment.duration.fn["as"+name]=function(){return+this/factor}}for(i in unitMillisecondFactors){if(unitMillisecondFactors.hasOwnProperty(i)){makeDurationAsGetter(i,unitMillisecondFactors[i]);makeDurationGetter(i.toLowerCase())}}makeDurationAsGetter("Weeks",6048e5);if(hasModule){module.exports=moment}if(typeof ender==="undefined"){this["moment"]=moment}if(typeof define==="function"&&define.amd){define("moment",[],function(){return moment})}}).call(this);(function(){var lang={months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",L:"YYYY-MM-DD",LL:"D MMMM, YYYY",LLL:"D MMMM, YYYY LT",LLLL:"dddd, D MMMM, YYYY LT"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(number){var b=number%10;return~~(number%100/10)===1?"th":b===1?"st":b===2?"nd":b===3?"rd":"th"}};if(typeof module!=="undefined"&&module.exports){module.exports=lang}if(typeof window!=="undefined"&&this.moment&&this.moment.lang){this.moment.lang("en-ca",lang)}})();(function(){var lang={months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[Aujourd'hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"une année",yy:"%d années"},ordinal:function(number){return number===1?"er":"ème"}};if(typeof module!=="undefined"&&module.exports){module.exports=lang}if(typeof window!=="undefined"&&this.moment&&this.moment.lang){this.moment.lang("fr-ca",lang)}})();(function(){var lang={months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),
weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[Aujourd'hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"une année",yy:"%d années"},ordinal:function(number){return number===1?"er":"ème"}};if(typeof module!=="undefined"&&module.exports){module.exports=lang}if(typeof window!=="undefined"&&this.moment&&this.moment.lang){this.moment.lang("fr",lang)}})();(function(){var lang={months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),longDateFormat:{LT:"H:mm U\\hr",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[Heute um] LT",sameElse:"L",nextDay:"[Morgen um] LT",nextWeek:"dddd [um] LT",lastDay:"[Gestern um] LT",lastWeek:"[letzten] dddd [um] LT"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",m:"einer Minute",mm:"%d Minuten",h:"einer Stunde",hh:"%d Stunden",d:"einem Tag",dd:"%d Tagen",M:"einem Monat",MM:"%d Monaten",y:"einem Jahr",yy:"%d Jahren"},ordinal:function(number){return"."}};if(typeof module!=="undefined"&&module.exports){module.exports=lang}if(typeof window!=="undefined"&&this.moment&&this.moment.lang){this.moment.lang("de",lang)}})();(function(){var pluralRules=[function(n){return n%10===1&&n%100!==11},function(n){return n%10>=2&&n%10<=4&&n%10%1===0&&(n%100<12||n%100>14)},function(n){return n%10===0||n%10>=5&&n%10<=9&&n%10%1===0||n%100>=11&&n%100<=14&&n%100%1===0},function(n){return true}],plural=function(word,num){var forms=word.split("_"),minCount=Math.min(pluralRules.length,forms.length),i=-1;while(++i<minCount){if(pluralRules[i](num)){return forms[i]}}return forms[minCount-1]},relativeTimeWithPlural=function(number,withoutSuffix,key){var format={mm:"минута_минуты_минут_минуты",hh:"час_часа_часов_часа",dd:"день_дня_дней_дня",MM:"месяц_месяца_месяцев_месяца",yy:"год_года_лет_года"};if(key==="m"){return withoutSuffix?"минута":"минуту"}else{return number+" "+plural(format[key],+number)}},monthsCaseReplace=function(m,format){var months={nominative:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),accusative:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_")},nounCase=/D[oD]? *MMMM?/.test(format)?"accusative":"nominative";return months[nounCase][m.month()]},weekdaysCaseReplace=function(m,format){var weekdays={nominative:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),accusative:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_")},nounCase=/\[ ?[Вв] ?(?:прошлую|следующую)? ?\] ?dddd/.test(format)?"accusative":"nominative";return weekdays[nounCase][m.day()]},lang={months:monthsCaseReplace,monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:weekdaysCaseReplace,weekdaysShort:"вск_пнд_втр_срд_чтв_птн_сбт".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., LT",LLLL:"dddd, D MMMM YYYY г., LT"},calendar:{sameDay:"[Сегодня в] LT",nextDay:"[Завтра в] LT",lastDay:"[Вчера в] LT",nextWeek:function(){return this.day()===2?"[Во] dddd [в] LT":"[В] dddd [в] LT"},lastWeek:function(){switch(this.day()){case 0:return"[В прошлое] dddd [в] LT";case 1:case 2:case 4:return"[В прошлый] dddd [в] LT";case 3:case 5:case 6:return"[В прошлую] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",m:relativeTimeWithPlural,mm:relativeTimeWithPlural,h:"час",hh:relativeTimeWithPlural,d:"день",dd:relativeTimeWithPlural,M:"месяц",MM:relativeTimeWithPlural,y:"год",yy:relativeTimeWithPlural},ordinal:function(number){return"."}};if(typeof module!=="undefined"&&module.exports){module.exports=lang}if(typeof window!=="undefined"&&this.moment&&this.moment.lang){this.moment.lang("ru",lang)}})();(function(root,undefined){var lib={};lib.version="0.4.1";lib.settings={currency:{symbol:"$",format:"%s%v",decimal:".",thousand:",",precision:2,grouping:3},number:{precision:0,grouping:3,thousand:",",decimal:"."}};var nativeMap=Array.prototype.map,nativeIsArray=Array.isArray,toString=Object.prototype.toString;function isString(obj){return!!(obj===""||obj&&obj.charCodeAt&&obj.substr)}function isArray(obj){return nativeIsArray?nativeIsArray(obj):toString.call(obj)==="[object Array]"}function isObject(obj){return obj&&toString.call(obj)==="[object Object]"}function defaults(object,defs){var key;object=object||{};defs=defs||{};for(key in defs){if(defs.hasOwnProperty(key)){if(object[key]==null)object[key]=defs[key]}}return object}function map(obj,iterator,context){var results=[],i,j;if(!obj)return results;if(nativeMap&&obj.map===nativeMap)return obj.map(iterator,context);for(i=0,j=obj.length;i<j;i++){results[i]=iterator.call(context,obj[i],i,obj)}return results}function checkPrecision(val,base){val=Math.round(Math.abs(val));return isNaN(val)?base:val}function checkCurrencyFormat(format){var defaults=lib.settings.currency.format;if(typeof format==="function")format=format();if(isString(format)&&format.match("%v")){return{pos:format,neg:format.replace("-","").replace("%v","-%v"),zero:format}}else if(!format||!format.pos||!format.pos.match("%v")){return!isString(defaults)?defaults:lib.settings.currency.format={pos:defaults,neg:defaults.replace("%v","-%v"),zero:defaults}}return format}var unformat=lib.unformat=lib.parse=function(value,decimal){if(isArray(value)){return map(value,function(val){return unformat(val,decimal)})}value=value||0;if(typeof value==="number")return value;decimal=decimal||lib.settings.number.decimal;var regex=new RegExp("[^0-9-"+decimal+"]",["g"]),unformatted=parseFloat((""+value).replace(/\((.*)\)/,"-$1").replace(regex,"").replace(decimal,"."));return!isNaN(unformatted)?unformatted:0};var toFixed=lib.toFixed=function(value,precision){precision=checkPrecision(precision,lib.settings.number.precision);var power=Math.pow(10,precision);return(Math.round(lib.unformat(value)*power)/power).toFixed(precision)};var formatNumber=lib.formatNumber=lib.format=function(number,precision,thousand,decimal){if(isArray(number)){return map(number,function(val){return formatNumber(val,precision,thousand,decimal)})}number=unformat(number);var opts=defaults(isObject(precision)?precision:{precision:precision,thousand:thousand,decimal:decimal},lib.settings.number),usePrecision=checkPrecision(opts.precision),negative=number<0?"-":"",base=parseInt(toFixed(Math.abs(number||0),usePrecision),10)+"",mod=base.length>3?base.length%3:0;return negative+(mod?base.substr(0,mod)+opts.thousand:"")+base.substr(mod).replace(/(\d{3})(?=\d)/g,"$1"+opts.thousand)+(usePrecision?opts.decimal+toFixed(Math.abs(number),usePrecision).split(".")[1]:"")};var formatMoney=lib.formatMoney=function(number,symbol,precision,thousand,decimal,format){if(isArray(number)){return map(number,function(val){return formatMoney(val,symbol,precision,thousand,decimal,format)})}number=unformat(number);var opts=defaults(isObject(symbol)?symbol:{symbol:symbol,precision:precision,thousand:thousand,decimal:decimal,format:format},lib.settings.currency),formats=checkCurrencyFormat(opts.format),useFormat=number>0?formats.pos:number<0?formats.neg:formats.zero;return useFormat.replace("%s",opts.symbol).replace("%v",formatNumber(Math.abs(number),checkPrecision(opts.precision),opts.thousand,opts.decimal))};lib.formatColumn=function(list,symbol,precision,thousand,decimal,format){if(!list)return[];var opts=defaults(isObject(symbol)?symbol:{symbol:symbol,precision:precision,thousand:thousand,decimal:decimal,format:format},lib.settings.currency),formats=checkCurrencyFormat(opts.format),padAfterSymbol=formats.pos.indexOf("%s")<formats.pos.indexOf("%v")?true:false,maxLength=0,formatted=map(list,function(val,i){if(isArray(val)){return lib.formatColumn(val,opts)}else{val=unformat(val);var useFormat=val>0?formats.pos:val<0?formats.neg:formats.zero,fVal=useFormat.replace("%s",opts.symbol).replace("%v",formatNumber(Math.abs(val),checkPrecision(opts.precision),opts.thousand,opts.decimal));if(fVal.length>maxLength)maxLength=fVal.length;return fVal}});return map(formatted,function(val,i){if(isString(val)&&val.length<maxLength){return padAfterSymbol?val.replace(opts.symbol,opts.symbol+new Array(maxLength-val.length+1).join(" ")):new Array(maxLength-val.length+1).join(" ")+val}return val})};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports){exports=module.exports=lib}exports.accounting=lib}else if(typeof define==="function"&&define.amd){define([],function(){return lib})}else{lib.noConflict=function(oldAccounting){return function(){root.accounting=oldAccounting;lib.noConflict=undefined;return lib}}(root.accounting);root["accounting"]=lib}})(this);window.ripple=ripple;ripple.define("accelerometer",function(ripple,exports,module){var _self,utils=ripple("utils"),event=ripple("event"),Rotation=ripple("platform/w3c/1.0/Rotation"),Acceleration=ripple("platform/w3c/1.0/Acceleration"),_motion={acceleration:new Acceleration(0,0,0),accelerationIncludingGravity:new Acceleration(0,0,-9.81),rotationRate:new Rotation(0,0,0),orientation:new Rotation(0,0,0),timestamp:(new Date).getTime()};_self={getInfo:function(){return utils.copy(_motion)},setInfo:function(e){var triggerDeviceMotion=false,triggerDeviceOrientation=false;if(e.x!==undefined&&e.y!==undefined&&e.z!==undefined){_motion={acceleration:new Acceleration(e.x,e.y,e.z),accelerationIncludingGravity:new Acceleration(e.x,e.y,e.z),rotationRate:new Rotation(0,0,0),orientation:new Rotation(e.alpha,e.beta,e.gamma),timestamp:(new Date).getTime()};triggerDeviceMotion=true;triggerDeviceOrientation=true}else{_motion={acceleration:new Acceleration(0,0,0),accelerationIncludingGravity:new Acceleration(0,0,-9.81),rotationRate:new Rotation(0,0,0),orientation:new Rotation(0,0,0),timestamp:(new Date).getTime()}}if(triggerDeviceMotion){event.trigger("DeviceMotionEvent",[_motion])}if(triggerDeviceOrientation){event.trigger("DeviceOrientationEvent",[_motion])}event.trigger("AccelerometerInfoChangedEvent",[_motion])},shake:function(shakeXtimes){var id,count=1,stopCount=shakeXtimes||17,oldX=_motion.accelerationIncludingGravity.x;id=setInterval(function(){var freq=1,amp=30,value=Math.round(amp*Math.sin(freq*count*(180/Math.PI))*100)/100;if(count>stopCount){_motion.accelerationIncludingGravity.x=oldX;event.trigger("AccelerometerInfoChangedEvent",[_motion]);clearInterval(id);return}_motion.accelerationIncludingGravity.x=value;event.trigger("AccelerometerInfoChangedEvent",[_motion]);count++},80)}};module.exports=_self});ripple.define("app",function(ripple,exports,module){var _data={},utils=ripple("utils"),_self;_self={setInfo:function(info){if(!info){_data={}}_data=info},getInfo:function(){return utils.copy(_data)},isPreferenceReadOnly:function(key){return _data.preferences&&_data.preferences[key]&&_data.preferences[key].readonly&&_data.preferences[key].readonly===true},validateVersion:function(configValidationObject){var spec=ripple("platform").current();if(typeof spec.config.validateVersion==="function"&&configValidationObject){return spec.config.validateVersion(configValidationObject)}return true},saveInfo:function(configValidationObject){var spec=ripple("platform").current(),info=null;if(typeof spec.config.extractInfo==="function"){info=spec.config.extractInfo(configValidationObject)}if(info){_self.setInfo(info)}}};module.exports=_self});ripple.define("appcache",function(ripple,exports,module){module.exports={initialize:function(){window.addEventListener("load",function(){window.applicationCache.addEventListener("updateready",function(){if(window.applicationCache.status===window.applicationCache.UPDATEREADY){window.applicationCache.swapCache();window.location.reload()}},false)},false)}}});ripple.define("bootstrap",function(ripple,exports,module){var _bound,_console=ripple("console");function _bindObjects(win,doc){if(!win.tinyHippos){ripple("emulatorBridge").init(win,doc);ripple("touchEventEmulator").init(win,doc);ripple("deviceMotionEmulator").init(win,doc);ripple("resizer").init(win,doc);ripple("cssMediaQueryEmulator").init(win,doc);_bound=true}}function _createFrame(src){var frame=document.createElement("iframe");frame.setAttribute("id","document");frame.src=src;return frame}function _post(src){var event=ripple("event"),frame=_createFrame(src);_console.log("Initialization Finished (Make it so.)");frame.onload=function(){var bootLoader=document.querySelector("#emulator-booting"),id;if(bootLoader){document.querySelector("#ui").removeChild(bootLoader)}event.trigger("TinyHipposLoaded");window.setTimeout(function(){window.clearInterval(id)},1200)};document.getElementById("viewport-container").appendChild(frame);delete tinyHippos.boot}function _bootstrap(){if(console.clear){console.clear()}_console.log("Ripple :: Environment Warming Up (Tea. Earl Grey. Hot.)");window.tinyHippos=ripple("index");tinyHippos.boot(function(){var uri=document.URL.replace(/enableripple=[^&]*[&]?/i,"").replace(/[\?&]*$/,"");_post(uri);delete tinyHippos.boot})}module.exports={bootstrap:_bootstrap,inject:function(frameWindow,frameDocument){_bindObjects(frameWindow,frameDocument)}}});ripple.define("bus",function(ripple,exports,module){var _send=document.getElementById("bus-send"),_receive=document.getElementById("bus-receive"),_evt=document.createEvent("Events");_evt.initEvent("bus-init",true,true);document.dispatchEvent(_evt);module.exports={send:function(msg,data,callback){var m=document.createElement("span");m.dataset.msg=msg;m.innerHTML=JSON.stringify(data);if(callback){m.dataset.callback=Math.uuid();this.receive(m.dataset.callback,callback)}_send.appendChild(m)},receive:function(msg,handler){if(!handler){return}_receive.addEventListener("DOMNodeInserted",function(evt){if(evt.target.dataset.msg===msg){handler(JSON.parse(evt.target.innerHTML))}})},ajax:function(method,url,data,success,fail){this.send("xhr",{method:method,url:url,data:data},function(result){if(result.code===200){success(result.data)}else{fail(result)}})}}});ripple.define("console",function(ripple,exports,module){var _self;function _log(msg,method){try{console[method](_self.prefix?_self.prefix+" :: "+msg:msg)}catch(e){}}_self={log:function(msg){_log(msg,"log")},warn:function(msg){_log(msg,"warn")},error:function(msg){_log(msg,"error")}};module.exports=_self});ripple.define("constants",function(ripple,exports,module){module.exports={API_URL:"https://rippleapi.herokuapp.com",SERVICES:{GOOGLE_MAPS_URI:"http://maps.google.com/maps/api/staticmap?size=476x476&maptype=roadmap",GOOGLE_MAPS_API_KEY:"ABQIAAAA-CaPZHXR-0Tzhui_h6gpjhSE_2rGlnYiB7L-ZGVwgaut5s7OYRSlBAaHCzBuZf2_23_vrCOfPxXHjA"},FS_SIZE:1024*1024*10,COMMON:{APPLICATION_STATE:"ui-application-state-",PREFIX:"tinyhippos-",MENU_BUTTON:"menu-button",BACK_BUTTON:"back-button",HTML_CONTAINER:"document",INFO_SECTION:"information-sub-container",ORIENTATION_SELECT_PORTRAIT_ID:"layout-portrait",ORIENTATION_SELECT_LANDSCAPE_ID:"layout-landscape",PLATFORM_SELECT_ID:"platform-select",DEVICE_SELECT_ID:"device-select",STORAGE_TABLE_BODY_CLASS:"preferences-list-body",STORAGE_COUNT_CONTAINER_ID:"preferences-count",GEO_MAP_CONTAINER_ID:"geo-map",FILESYSTEM_UPDATE_BUTTON_ID_WITH_HASH:"#update-filesystem-button",APPLICATIONS_CONTAINER_ID:"widget-applications-content",STORAGE_CLEAR_BUTTON_ID:"preferences-clear-button",CHANGE_PLATFORM_BUTTON_ID:"change-platform",AJAX_LOADER_CONTAINER_CLASS:".loader",IRRELEVANT_CLASS:"irrelevant",MULTIMEDIA_VOLUME_SLIDER_ID:"media-volume",MULTIMEDIA_VOLUME_FIELD_ID:"media-volume-value",MULTIMEDIA_AUDIO_STATE_FIELD_ID:"media-audio-state",MULTIMEDIA_AUDIO_PLAYING_FIELD_ID:"multimedia-isaudioplaying",MULTIMEDIA_AUDIO_PROGRESS_ID:"media-audio-progress",MULTIMEDIA_AUDIO_FILE_FIELD_ID:"media-audio-file",MULTIMEDIA_VIDEO_STATE_FIELD_ID:"media-video-state",MULTIMEDIA_VIDEO_PLAYING_FIELD_ID:"multimedia-isvideoplaying",MULTIMEDIA_VIDEO_PROGRESS_ID:"media-video-progress",MULTIMEDIA_VIDEO_FILE_FIELD_ID:"media-video-file",EXTENSION_URL_CONTAINER:"extension-url",SECURITY_LEVEL:"security-level"},FILESYSTEM:{PERSISTENCE_KEY:"filesystem",INPUT_PREFIX_ID:"#panel-filesystem-"},PLATFORM:{DEFAULT:{name:"cordova",version:"1.0.0"}},ENCAPSULATOR:{DEFAULT_HEIGHT:684,DEFAULT_WIDTH:480},GEO:{OPTIONS:{LATITUDE:"geo-latitude",LONGITUDE:"geo-longitude",ALTITUDE:"geo-altitude",CELL_ID:"geo-cellid",ACCURACY:"geo-accuracy",ALTITUDE_ACCURACY:"geo-altitudeaccuracy",HEADING:"geo-heading",SPEED:"geo-speed",TIME_STAMP:"geo-timestamp",DELAY:"geo-delay",DELAY_LABEL:"geo-delay-label",HEADING_LABEL:"geo-heading-label",HEADING_MAP_LABEL:"geo-map-direction-label",IMAGE:"geo-map-img",MAP_MARKER:"geo-map-marker",MAP_CONTAINER:"geo-map-container",TIMEOUT:"geo-timeout",GPXFILE:"geo-gpxfile",GPXGO:"geo-gpx-go",GPXMULTIPLIER:"geo-gpxmultiplier-select",GPXREPLAYSTATUS:"geo-gpxreplaystatus"},MAP_ZOOM_MAX:21,MAP_ZOOM_MIN:0,MAP_ZOOM_LEVEL_CONTAINER:"geo-map-zoomlevel-value",MAP_ZOOM_KEY:"geo-map-zoom-key",GPXGO_LABELS:{GO:"Go",STOP:"Stop"}},PUSH:{OPTIONS:{PAYLOAD:"push-text"}},TELEPHONY:{CALL_LIST_KEY:"telephony-call-list-key"},PIM:{ADDRESS_LIST_KEY:"pim-address-list-key",CALENDAR_LIST_KEY:"pim-calendar-list-key"},CAMERA:{WINDOW_ANIMATION:"images/dance.gif",WARNING_TEXT:"The runtime simulated saving the camera file to {file}. If you need to access this file in your application, please copy a file to the saved location"},AUDIOPLAYER:{WARNING_TEXT:"The runtime simulated saving the audio file to {file}. If you need to access this file in your application, please copy a file to the saved location"},API_APPLICATION:{NO_APPLICATIONS_MESSAGE:"No applications available for your platform"},NOTIFICATIONS:{MESSAGE_CONTAINER_CLASS:"notification-message-div",MAIN_CONTAINER_CLASS:"panel-notification",CLOSE_BUTTON_CLASS:"panel-notification-closebtn",MESSAGE_TEXT_CONTAINER_CLASS:"panel-notification-text",CSS_PREFIX:"panel-notification-",STATE_TYPES:{OPEN:1,CLOSE:2}},BATTERY_STATUS:{BATTERY_STATUS_KEY:"battery-status-key",IS_PLUGGED_KEY:"is-plugged-key",LEVEL_LABEL:"battery-level-label",LEVEL_VALUE:"battery-level",IS_PLUGGED_CHECKBOX:"is-plugged"},CSS_PREFIX:{IRRELEVANT:"irrelevant"},STORAGE:{PAIR_DELIMETER:",",KEY_VALUE_DELIMETER:"|"},REGEX:{GEO:/^geo-/,URL:/^((https?|ftp|gopher|telnet|file|notes|ms-help):((\/\/)|(\\\\))+[\w\d:#@%\/;$()~_?\+-=\\\.&]*)$/,EMAIL:/^([^@\s]+)@((?:[\-a-z0-9]+\.)+[a-z]{2,})$/,WC3_DTF:/^((\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)|(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d)|(\d{4})-(\d\d)-(\d\d)|(\d{4})-(\d\d)|(\d\d\d\d))$/,NON_RELATIVE_URI:/^https?:\/\/|^file:\/\//},CONFIG:{SUCCESS_CSS:{"true":"ui-text-pass","false":"ui-text-fail",missing:"ui-text-missing"}},SETTINGS:{TOOLTIPS_TOGGLE_DIV:"#settings-toggletooltips",TOOLTIPS_KEY:"tool-tips-key"},UI:{JQUERY_UI_BUTTON_CLASSES:"ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only",JQUERY_UI_INPUT_CLASSES:"ui-state-default ui-corner-all",PANEL_TABLE_CLASS:"panel-table",RIGHT_RANGE_LABEL_CLASS:"range-label",LEFT_RANGE_LABEL_CLASS:"range-label-left",TEXT_LABEL_CLASS:"ui-text-label",SCREEN_PPI:96},MULTIMEDIA:{AUDIO_STATES:{OPENED:"opened",STOPPED:"stopped",PAUSED:"paused",PLAYING:"playing",COMPLETED:"completed"}},LANG:{ISO6392_LIST:["abk","ace","ach","ada","ady","aar","afh","afr","afa","ain","aka","akk","alb/sqi","gsw","ale","alg","tut","amh","anp","apa","ara","arg","arp","arw","arm/hye","rup","art","asm","ast","ath","aus","map","ava","ave","awa","aym","aze","ban","bat","bal","bam","bai","bad","bnt","bas","bak","baq/eus","btk","bej","bel","bem","ben","ber","bho","bih","bik","byn","bin","bis","zbl","nob","bos","bra","bre","bug","bul","bua","bur/mya","cad","spa","cat","cau","ceb","cel","cai","khm","chg","cmc","cha","che","chr","nya","chy","chb","chi/zho","chn","chp","cho","zha","chu","chk","chv","nwc","syc","rar","cop","cor","cos","cre","mus","crp","cpe","cpf","cpp","crh","hrv","cus","cze/ces","dak","dan","dar","del","div","zza","din","doi","dgr","dra","dua","dut/nld","dum","dyu","dzo","frs","efi","egy","eka","elx","eng","enm","ang","myv","epo","est","ewe","ewo","fan","fat","fao","fij","fil","fin","fiu","fon","fre/fra","frm","fro","fur","ful","gaa","gla","car","glg","lug","gay","gba","gez","geo/kat","ger/deu","nds","gmh","goh","gem","kik","gil","gon","gor","got","grb","grc","gre/ell","kal","grn","guj","gwi","hai","hat","hau","haw","heb","her","hil","him","hin","hmo","hit","hmn","hun","hup","iba","ice/isl","ido","ibo","ijo","ilo","arc","smn","inc","ine","ind","inh","ina","ile","iku","ipk","ira","gle","mga","sga","iro","ita","jpn","jav","kac","jrb","jpr","kbd","kab","xal","kam","kan","kau","pam","kaa","krc","krl","kar","kas","csb","kaw","kaz","kha","khi","kho","kmb","kin","kir","tlh","kom","kon","kok","kor","kos","kpe","kro","kua","kum","kur","kru","kut","lad","lah","lam","day","lao","lat","lav","ltz","lez","lim","lin","lit","jbo","dsb","loz","lub","lua","lui","smj","lun","luo","lus","mac/mkd","mad","mag","mai","mak","mlg","may/msa","mal","mlt","mnc","mdr","man","mni","mno","glv","mao/mri","arn","mar","chm","mah","mwr","mas","myn","men","mic","min","mwl","moh","mdf","rum/ron","mkh","lol","mon","mos","mul","mun","nqo","nah","nau","nav","nde","nbl","ndo","nap","new","nep","nia","nic","ssa","niu","zxx","nog","non","nai","frr","sme","nso","nor","nno","nub","iii","nym","nyn","nyo","nzi","oci","pro","oji","ori","orm","osa","oss","oto","pal","pau","pli","pag","pan","pap","paa","pus","per/fas","peo","phi","phn","pon","pol","por","pra","que","raj","rap","qaa-qtz","roa","roh","rom","run","rus","sal","sam","smi","smo","sad","sag","san","sat","srd","sas","sco","sel","sem","srp","srr","shn","sna","scn","sid","sgn","bla","snd","sin","sit","sio","sms","den","sla","slo/slk","slv","sog","som","son","snk","wen","sot","sai","alt","sma","srn","suk","sux","sun","sus","swa","ssw","swe","syr","tgl","tah","tai","tgk","tmh","tam","tat","tel","ter","tet","tha","tib/bod","tig","tir","tem","tiv","tli","tpi","tkl","tog","ton","tsi","tso","tsn","tum","tup","tur","ota","tuk","tvl","tyv","twi","udm","uga","uig","ukr","umb","mis","und","hsb","urd","uzb","vai","ven","vie","vol","vot","wak","wln","war","was","wel/cym","fry","wal","wol","xho","sah","yao","yap","yid","yor","ypk","znd","zap","zen","zul","zun"]},XHR:{PROXY_SETTING:"settings-xhr-proxy-setting",PROXY_SETTINGS_LIST:{remote:"remote",local:"local",disabled:"disabled"},DEFAULT_LOCAL_PORT:4400,DEFAULT_LOCAL_ROUTE:"/ripple",LOCAL_PROXY_PORT_SETTING:"settings-xhr-proxy-local-port",LOCAL_PROXY_ROUTE_SETTING:"settings-xhr-proxy-local-route"}}});ripple.define("cssMediaQueryEmulator",function(ripple,exports,module){var utils=ripple("utils"),emulateRules,transforms={"-webkit-device-pixel-ratio":{regex:/\-webkit(\-min|\-max)?\-device\-pixel\-ratio\:\s(\d*(\.\d*)?)/i,action:function(mq,matches){var value=parseFloat(matches[2]),prefix=matches[1];if(!prefix&&value===emulateRules["-webkit-device-pixel-ratio"]||prefix&&prefix==="-min"&&value<=emulateRules["-webkit-device-pixel-ratio"]||prefix&&prefix==="-max"&&value>=emulateRules["-webkit-device-pixel-ratio"]){mq.media.mediaText=mq.media.mediaText.replace(matches[2],"1")}}}};module.exports={init:function(win,doc){emulateRules=ripple("devices").getCurrentDevice().mediaQueryEmulation;if(!emulateRules){return}doc.addEventListener("DOMContentLoaded",function(){var media=[];utils.forEach(doc.styleSheets,function(sheet){if(sheet.media&&sheet.media.mediaText){media.push(sheet)}utils.filter(sheet.cssRules,function(rule){return!!rule.media}).forEach(function(rule){media.push(rule)})});media.forEach(function(mq){utils.forEach(transforms,function(transform){var matches=mq.media.mediaText.match(transform.regex);if(matches){transform.action(mq,matches)}})})})}}});ripple.define("db",function(ripple,exports,module){var utils=ripple("utils"),constants=ripple("constants"),event=ripple("event"),DB_NAME="ripple",cache,self,opendb;function saveToStorage(){localStorage[DB_NAME]=JSON.stringify(cache)}function validateAndSetPrefix(prefix){if(prefix){utils.validateArgumentType(prefix,"string")}return prefix||constants.COMMON.PREFIX}function createKey(key,prefix){return validateAndSetPrefix(prefix)+key}function createItem(key,value,prefix){return{id:createKey(key,prefix),key:key,value:value,prefix:validateAndSetPrefix(prefix)}}function save(key,value,prefix,callback){var item=createItem(key,value,prefix);cache[item.id]=item;if(!window.openDatabase){saveToStorage();if(callback){callback()}}else{opendb.transaction(function(tx){tx.executeSql("REPLACE INTO persistence (id, key, value, prefix) VALUES (?, ?, ?, ?)",[item.id,item.key,item.value,item.prefix],function(){return callback&&callback()})})}}function retrieve(key,prefix){var item=cache[createKey(key,prefix)];return item?item.value:undefined}function retrieveAll(prefix,callback){var result={};if(prefix){utils.forEach(cache,function(value){if(value.prefix===prefix){result[value.key]=value.value}})}if(callback){callback(result)}}function remove(key,prefix,callback){var id=createKey(key,prefix);delete cache[id];if(!window.openDatabase){saveToStorage();if(callback){callback()}}else{opendb.transaction(function(tx){tx.executeSql("DELETE FROM persistence WHERE key = ? AND prefix = ?",[key,validateAndSetPrefix(prefix)],function(){return callback&&callback()})})}}function removeAll(callback){cache={};if(!window.openDatabase){delete localStorage[DB_NAME];saveToStorage()}else{opendb.transaction(function(tx){tx.executeSql("DELETE FROM persistence",[],function(){return callback&&callback()})})}}self={save:function(key,value,prefix,callback){save(key,value,prefix,callback);event.trigger("StorageUpdatedEvent")},saveObject:function(key,obj,prefix,callback){save(key,JSON.stringify(obj),prefix,callback);event.trigger("StorageUpdatedEvent")},retrieve:function(key,prefix){return retrieve(key,prefix)},retrieveObject:function(key,prefix){var retrievedValue=retrieve(key,prefix);return retrievedValue?JSON.parse(retrievedValue):retrievedValue},retrieveAll:function(prefix,callback){return retrieveAll(prefix,callback)},remove:function(key,prefix,callback){event.trigger("StorageUpdatedEvent");remove(key,prefix,callback)},removeAll:function(callback){removeAll(callback);event.trigger("StorageUpdatedEvent")},initialize:function(previous,baton){if(!window.openDatabase){var store=localStorage[DB_NAME];cache=store?JSON.parse(store):{};saveToStorage()}else{baton.take();cache={};opendb=openDatabase("tinyHippos","1.0","tiny Hippos persistence",2*1024*1024);opendb.transaction(function(tx){tx.executeSql("CREATE TABLE IF NOT EXISTS persistence (id unique, key, value, prefix)");tx.executeSql("SELECT id, key, value, prefix FROM persistence",[],function(tx,results){var len=results.rows.length,i,item;for(i=0;i<len;i++){item=results.rows.item(i);cache[item.id]=item}baton.pass()})})}}};module.exports=self});ripple.define("deviceMotionEmulator",function(ripple,exports,module){var event=ripple("event"),_self;function _bind(name,win){var callback=null;win.__defineGetter__(name,function(){return callback});win.__defineSetter__(name,function(cb){callback=cb});return{get:function(){return callback},set:function(value){callback=value},exec:function(arg){return callback&&callback(arg)},unbind:function(cb){callback=cb===callback?null:callback}}}_self={init:function(win){var widgetWindow=win,_motion,_orientation,add=widgetWindow.addEventListener,remove=widgetWindow.removeEventListener;widgetWindow.DeviceMotionEvent=function DeviceMotionEvent(){};widgetWindow.DeviceOrientationEvent=function DeviceOrientationEvent(){};_motion=_bind("ondevicemotion",widgetWindow);_orientation=_bind("ondeviceorientation",widgetWindow);widgetWindow.addEventListener=function(event,callback){if(event==="deviceorientation"){_orientation.set(callback)}else if(event==="devicemotion"){_motion.set(callback)}else{add.apply(widgetWindow,arguments)}};widgetWindow.removeEventListener=function(event,callback){_motion.unbind(callback);_orientation.unbind(callback);remove.apply(widgetWindow,arguments)};event.on("DeviceMotionEvent",function(motion){_motion.exec({acceleration:motion.acceleration,accelerationIncludingGravity:motion.accelerationIncludingGravity,rotationRate:motion.rotationRate})});event.on("DeviceOrientationEvent",function(motion){_orientation.exec(motion.orientation)})}};module.exports=_self});ripple.define("deviceSettings",function(ripple,exports,module){var _PERSISTENCE_KEY="devicesettings",db=ripple("db"),platform=ripple("platform"),event=ripple("event"),_currentDeviceSettings={},_self;function _default(key){var keys=key.split("."),defaults=platform.current().device;return keys.length===2&&defaults[keys[0]]&&defaults[keys[0]][keys[1]]&&defaults[keys[0]][keys[1]].control?defaults[keys[0]][keys[1]].control.value:undefined}_self={initialize:function(){_currentDeviceSettings=db.retrieveObject(_PERSISTENCE_KEY)||{}},register:function(key,obj){_currentDeviceSettings[key]=obj},persist:function(key,obj){if(key){_currentDeviceSettings[key]=obj}db.saveObject(_PERSISTENCE_KEY,_currentDeviceSettings);event.trigger("DeviceSettingsUpdated",[key,obj])},retrieve:function(key){return _currentDeviceSettings.hasOwnProperty(key)?_currentDeviceSettings[key]:_default(key)},retrieveAsInt:function(key){return parseInt(_self.retrieve(key),10)},retrieveAsBoolean:function(key){return!!_self.retrieve(key)}};module.exports=_self});ripple.define("devices/AcerA500",function(ripple,exports,module){module.exports={id:"AcerA500",name:"Acer A500",model:"Picasso",osName:"Android",uuid:"500",osVersion:"4.0",manufacturer:"Acer",screen:{width:800,height:1280},viewPort:{portrait:{width:800,height:1242,paddingTop:38,paddingLeft:0},landscape:{width:1280,height:762,paddingTop:38,paddingLeft:0}},ppi:149,userAgent:"Mozilla/5.0 (Linux; Android 4.0.3; A500 Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19",platforms:["web","phonegap","cordova"],notes:{1:'<a href="http://www.acer.ru/ac/ru/RU/content/model/XE.H60EN.011" target="_blank">Specs</a>'}}});ripple.define("devices/Bold9700",function(ripple,exports,module){module.exports={id:"Bold9700",name:"BlackBerry Bold 9700",model:"9700",osName:"BlackBerry OS",uuid:"42",osVersion:"6",manufacturer:"BlackBerry",capabilities:["location.gps","location.maps","media.audio.capture","media.video.capture","media.recording","storage.memorycard","network.bluetooth","network.wlan","network.3gpp"],screen:{width:480,height:360},viewPort:{portrait:{width:480,height:360,paddingTop:0,paddingLeft:0}},ppi:246,userAgent:"Mozilla/5.0 (BlackBerry; U; BlackBerry 9700; en) AppleWebKit/534.1+ (KHTML, Like Gecko) Version/6.0.0.141 Mobile Safari/534.1",platforms:["web","cordova","webworks.handset"]}});ripple.define("devices/Bold9900",function(ripple,exports,module){module.exports={id:"Bold9900",name:"BlackBerry Bold 9900",model:"9900",osName:"BlackBerry OS",uuid:"42",osVersion:"7",manufacturer:"BlackBerry",capabilities:["input.touch","location.gps","location.maps","media.audio.capture","media.video.capture","media.recording","storage.memorycard","network.bluetooth","network.wlan","network.3gpp"],screen:{width:640,height:480},viewPort:{portrait:{width:640,height:480,paddingTop:0,paddingLeft:0}},ppi:286,userAgent:"Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en) AppleWebKit/534.1+ (KHTML, Like Gecko) Version/7.0.0.141 Mobile Safari/534.1",platforms:["web","cordova","webworks.handset"]
}});ripple.define("devices/Curve9300",function(ripple,exports,module){module.exports={id:"Curve9300",name:"BlackBerry Curve 9300",model:"9300",osName:"BlackBerry OS",uuid:"42",osVersion:"6",manufacturer:"BlackBerry",capabilities:["location.gps","location.maps","media.audio.capture","media.video.capture","media.recording","storage.memorycard","network.bluetooth","network.wlan","network.3gpp"],screen:{width:320,height:240},viewPort:{portrait:{width:320,height:240,paddingTop:0,paddingLeft:0}},ppi:163,userAgent:"Mozilla/5.0 (BlackBerry; U; BlackBerry 9300; en) AppleWebKit/534.3+ (KHTML, like Gecko) Version/6.0.0.286 Mobile Safari/534.3+",platforms:["web","cordova","webworks.handset"]}});ripple.define("devices/Curve9350-9360-9370",function(ripple,exports,module){module.exports={id:"Curve9350-9360-9370",name:"BlackBerry Curve 9350/9360/9370",model:"9350-9360-9370",osName:"BlackBerry OS",uuid:"42",osVersion:"7",manufacturer:"BlackBerry",capabilities:["location.gps","location.maps","media.audio.capture","media.video.capture","media.recording","storage.memorycard","network.bluetooth","network.wlan","network.3gpp"],screen:{width:480,height:360},viewPort:{portrait:{width:480,height:360,paddingTop:0,paddingLeft:0}},ppi:244,userAgent:"Mozilla/5.0 (BlackBerry; U; BlackBerry 9350; en) AppleWebKit/534.1+ (KHTML, Like Gecko) Version/7.0.0.0 Mobile Safari/534.1",platforms:["web","cordova","webworks.handset"]}});ripple.define("devices/FWVGA",function(ripple,exports,module){module.exports={group:"Generic Devices",id:"FWVGA",name:"Generic - FWVGA (480x854)",osName:"Generic",osVersion:"Generic",manufacturer:"Generic",model:"Generic",uuid:"42",screen:{width:480,height:854},viewPort:{portrait:{width:480,height:854,paddingTop:0,paddingLeft:0},landscape:{width:854,height:480,paddingTop:0,paddingLeft:0}},ppi:96,platforms:["web","cordova"]}});ripple.define("devices/G1",function(ripple,exports,module){module.exports={id:"G1",name:"HTC G1",model:"G1",osName:"Android",osVersion:"1.6",uuid:"6F196F23-FD0D-4F62-B27B-730147FCC5A3",manufacturer:"HTC",screen:{width:320,height:480},viewPort:{portrait:{width:320,height:480,paddingTop:0,paddingLeft:0},landscape:{width:480,height:320,paddingTop:0,paddingLeft:0}},ppi:181,platforms:["web","cordova"],userAgent:"Mozilla/5.0 (Linux; U; Android 1.0; en-us; dream) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2",notes:{1:'<a href="http://www.htc.com/www/product/g1/specification.html" target="_blank">Specs</a>'}}});ripple.define("devices/HPPre3",function(ripple,exports,module){module.exports={id:"HPPre3",name:"HP Pre 3",manufacturer:"HP",model:"Pre",osName:"WebOS",osVersion:"2.x",screen:{width:480,height:800},viewPort:{portrait:{width:480,height:800,paddingTop:0,paddingLeft:0},landscape:{width:800,height:480,paddingTop:0,paddingLeft:0}},ppi:260,userAgent:"Mozilla/5.0 (webOS/2.0; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/2.0",platforms:["web","cordova"],notes:{1:'<a href="http://www.palm.com/us/products/phones/pre3/index.html" target="_blank">Specs</a>'}}});ripple.define("devices/HPVeer",function(ripple,exports,module){module.exports={id:"HPVeer",name:"HP Veer",manufacturer:"HP",model:"Veer",osName:"WebOS",osVersion:"2.x",screen:{width:320,height:400},viewPort:{portrait:{width:320,height:400,paddingTop:0,paddingLeft:0},landscape:{width:400,height:320,paddingTop:0,paddingLeft:0}},ppi:197,userAgent:"Mozilla/5.0 (webOS/2.0; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/2.0",platforms:["web","cordova"],notes:{1:'<a href="http://www.palm.com/us/products/phones/veer/index.html" target="_blank">Specs</a>'}}});ripple.define("devices/HVGA",function(ripple,exports,module){module.exports={group:"Generic Devices",id:"HVGA",name:"Generic - HVGA (320x480)",osName:"Generic",osVersion:"Generic",manufacturer:"Generic",model:"Generic",uuid:"42",screen:{width:320,height:480},viewPort:{portrait:{width:320,height:480,paddingTop:0,paddingLeft:0},landscape:{width:480,height:320,paddingTop:0,paddingLeft:0}},ppi:96,platforms:["web","cordova"]}});ripple.define("devices/Legend",function(ripple,exports,module){module.exports={id:"Legend",name:"HTC Legend",osName:"Android",osVersion:"1.6",manufacturer:"HTC",model:"Legend",uuid:"6F196F23-FD0D-4F62-B27B-730147FCC5A3",screen:{width:320,height:480},viewPort:{portrait:{width:320,height:480,paddingTop:0,paddingLeft:0},landscape:{width:480,height:320,paddingTop:0,paddingLeft:0}},ppi:181,userAgent:"Mozilla/5.0 (Linux; U; Android 2.1; fr-fr; HTC Legend 1.32.163.1 Build/ERD79) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17",platforms:["web","cordova"]}});ripple.define("devices/Nexus",function(ripple,exports,module){module.exports={id:"Nexus",name:"Nexus One",manufacturer:"HTC",model:"Nexux One",osName:"Android",uuid:"6F196F23-FD0D-4F62-B27B-730147FCC5A3",osVersion:"2.x.x",screen:{width:480,height:800},viewPort:{portrait:{width:480,height:800,paddingTop:0,paddingLeft:0},landscape:{width:800,height:480,paddingTop:0,paddingLeft:0}},ppi:252,userAgent:"Mozilla/5.0 (Linux; U; Android 2.1; en-us; Nexus One Build/ERD62) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17",platforms:["web","cordova"],notes:{1:'<a href="http://www.google.com/phone/static/en_US-nexusone_tech_specs.html" target="_blank">Specs</a>'},mediaQueryEmulation:{"-webkit-device-pixel-ratio":1.5}}});ripple.define("devices/Nexus4",function(ripple,exports,module){module.exports={id:"Nexus4",name:"Nexus 4",manufacturer:"LG",model:"Nexus 4",osName:"Android",uuid:"DC46B660-EF6F-46D4-AC24-85CFAB0C7694",osVersion:"4.2.x",screen:{width:768,height:1280},viewPort:{portrait:{width:768,height:1280,paddingTop:0,paddingLeft:0},landscape:{width:1280,height:768,paddingTop:0,paddingLeft:0}},ppi:320,userAgent:"Mozilla/5.0 (Linux; Android 4.2.2; Nexus 4 Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19",platforms:["web","cordova"],notes:{1:'<a href="http://www.google.com/nexus/4/specs/" target="_blank">Specs</a>'},mediaQueryEmulation:{"-webkit-device-pixel-ratio":2}}});ripple.define("devices/Nexus7",function(ripple,exports,module){module.exports={id:"Nexus7",name:"Nexus 7 (Tablet)",manufacturer:"Asus",model:"Nexus 7 8/16 GB",osName:"Android",uuid:"903802EA-1786-4175-B0F1-1FDF87813CAA",osVersion:"4.x.x",screen:{width:800,height:1280},viewPort:{portrait:{width:800,height:1280,paddingTop:0,paddingLeft:0},landscape:{width:1280,height:800,paddingTop:0,paddingLeft:0}},ppi:216,userAgent:"Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19",platforms:["web","cordova"],notes:{1:'<a href="http://www.google.com/nexus/#/7/specs" target="_blank">Specs</a>'}}});ripple.define("devices/NexusGalaxy",function(ripple,exports,module){module.exports={id:"NexusGalaxy",name:"Nexus (Galaxy)",manufacturer:"Samsung",model:"Galaxy Nexus (generic)",osName:"Android",uuid:"3D0AD03B-8B46-431A-BEF5-FF01B96BA990",osVersion:"4.x.x",screen:{width:720,height:1280},viewPort:{portrait:{width:720,height:1280,paddingTop:0,paddingLeft:0},landscape:{width:1280,height:720,paddingTop:0,paddingLeft:0}},ppi:316,userAgent:"Mozilla/5.0 (Linux; Android 4.0.1; Galaxy Nexus Build/ITL41F) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19",platforms:["web","cordova"],notes:{1:'<a href="http://www.google.com/nexus/#/tech-specs" target="_blank">Specs</a>'},mediaQueryEmulation:{"-webkit-device-pixel-ratio":2}}});ripple.define("devices/NexusS",function(ripple,exports,module){module.exports={id:"NexusS",name:"Nexus S",manufacturer:"Samsung",model:"Nexux S",osName:"Android",uuid:"F54E13F1-C1B7-4212-BFA8-AB3C9C3F088F",osVersion:"2.3.x",screen:{width:480,height:800},viewPort:{portrait:{width:480,height:800,paddingTop:0,paddingLeft:0},landscape:{width:800,height:480,paddingTop:0,paddingLeft:0}},ppi:233,userAgent:"Mozilla/5.0 (Linux; U; Android 2.3.2; en-us; Nexus S Build/GRH78C) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",platforms:["web","cordova"],notes:{1:'<a href="http://www.google.com/nexus/#/tech-specs" target="_blank">Specs</a>'},mediaQueryEmulation:{"-webkit-device-pixel-ratio":1.5}}});ripple.define("devices/NokiaN8",function(ripple,exports,module){module.exports={id:"NokiaN8",name:"Nokia N8",model:"N8",osName:"SymbianOS",uuid:"42",osVersion:"3",manufacturer:"Nokia",screen:{width:360,height:640},viewPort:{portrait:{width:360,height:640,paddingTop:0,paddingLeft:0},landscape:{width:640,height:360,paddingTop:0,paddingLeft:0}},ppi:209,userAgent:"(Symbian/3; S60/5.2 Mozilla/5.0; NokiaN8-00/10.0.000; Profile/MIDP-2.1 Configuration/CLDC-1.1) AppleWebKit/525 (KHTML, like Gecko) BrowserNG/7.2",platforms:["web","cordova"],notes:{1:'<a href="http://www.forum.nokia.com/Devices/Device_specifications/N8-00/" target="_blank">Specs</a>'}}});ripple.define("devices/NokiaN97",function(ripple,exports,module){module.exports={id:"NokiaN97",name:"Nokia N97/5800 (touch)",manufacturer:"Nokia",model:"N97",osName:"S60",osVersion:"v5",uuid:"42",screen:{width:360,height:640},viewPort:{portrait:{width:360,height:640,paddingTop:0,paddingLeft:0},landscape:{width:640,height:360,paddingTop:0,paddingLeft:0}},ppi:209,userAgent:"?",platforms:["web","cordova"]}});ripple.define("devices/PalmPre",function(ripple,exports,module){module.exports={id:"PalmPre",name:"Palm Pre",manufacturer:"Palm",model:"Pre",osName:"WebOS",osVersion:"1.x",screen:{width:320,height:480},viewPort:{portrait:{width:320,height:480,paddingTop:0,paddingLeft:0},landscape:{width:480,height:320,paddingTop:0,paddingLeft:0}},ppi:186,userAgent:"Mozilla/5.0 (webOS/1.0; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/1.0",platforms:["web","cordova"],notes:{1:'<a href="http://www.palm.com/us/products/phones/pre/#tab2" target="_blank">Specs</a>'}}});ripple.define("devices/PalmPre2",function(ripple,exports,module){module.exports={id:"PalmPre2",name:"Palm Pre 2",manufacturer:"Palm",model:"Pre",osName:"WebOS",osVersion:"2.x",screen:{width:320,height:480},viewPort:{portrait:{width:320,height:480,paddingTop:0,paddingLeft:0},landscape:{width:480,height:320,paddingTop:0,paddingLeft:0}},ppi:186,userAgent:"Mozilla/5.0 (webOS/2.0; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/2.0",platforms:["web","cordova"],notes:{1:'<a href="http://www.palm.com/us/products/phones/pre2/#tab2" target="_blank">Specs</a>'}}});ripple.define("devices/Pearl9100",function(ripple,exports,module){module.exports={id:"Pearl9100",name:"BlackBerry Pearl 9100",model:"9100",osName:"BlackBerry OS",uuid:"42",osVersion:"6",manufacturer:"Research In Motion",capabilities:["input.keyboard.issuretype","location.gps","location.maps","media.audio.capture","media.video.capture","media.recording","storage.memorycard","network.bluetooth","network.wlan","network.3gpp"],screen:{width:360,height:400},viewPort:{portrait:{width:360,height:400,paddingTop:0,paddingLeft:0}},ppi:239,userAgent:"Mozilla/5.0 (BlackBerry; U; BlackBerry 9100; en) AppleWebKit/534.3+ (KHTML, like Gecko) Version/6.0.0.286 Mobile Safari/534.3+",platforms:["web","cordova","webworks.handset"]}});ripple.define("devices/Playbook",function(ripple,exports,module){module.exports={id:"Playbook",name:"BlackBerry Playbook",model:"100669958",osName:"BlackBerry PlayBook OS",uuid:"42",osVersion:"BlackBerry PlayBook OS",manufacturer:"BlackBerry",capabilities:["input.touch","location.gps","media.audio.capture","media.video.capture","media.recording","network.bluetooth","network.wlan"],screen:{width:1024,height:600},viewPort:{portrait:{width:1024,height:600,paddingTop:0,paddingLeft:0},landscape:{width:600,height:1024,paddingTop:0,paddingLeft:0}},defaultOrientation:"landscape",ppi:169,userAgent:"Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML, like Gecko) Version/7.2.1.0 Safari/536.2+",platforms:["web","webworks.tablet","cordova"]}});ripple.define("devices/Q10",function(ripple,exports,module){module.exports={id:"Q10",name:"BlackBerry Q10",model:"Q10",osName:"BlackBerry",uuid:"42",osVersion:"10.1",manufacturer:"BlackBerry",hardwareId:"0x8400270a",capabilities:["input.touch","location.gps","media.audio.capture","media.video.capture","media.recording","network.bluetooth","network.wlan"],screen:{width:720,height:720},viewPort:{portrait:{width:720,height:720,paddingTop:0,paddingLeft:0}},defaultOrientation:"portrait",ppi:330,userAgent:"Mozilla/5.0 (BB10; Kbd) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.1.0.42 Mobile Safari/537.10+",platforms:["web","webworks.bb10","cordova"],mediaQueryEmulation:{"-webkit-device-pixel-ratio":2.08}}});ripple.define("devices/QVGA",function(ripple,exports,module){module.exports={id:"QVGA",name:"Generic - QVGA (240X320)",osName:"Generic",osVersion:"Generic",manufacturer:"Generic",model:"Generic",uuid:"42",screen:{width:240,height:320},viewPort:{portrait:{width:240,height:320,paddingTop:0,paddingLeft:0},landscape:{width:320,height:240,paddingTop:0,paddingLeft:0}},ppi:96,platforms:["web","cordova"]}});ripple.define("devices/Style9670",function(ripple,exports,module){module.exports={id:"Style9670",name:"BlackBerry Style 9670",model:"9670",osName:"BlackBerry OS",uuid:"42",osVersion:"6",manufacturer:"BlackBerry",capabilities:["location.gps","location.maps","media.audio.capture","media.video.capture","media.recording","storage.memorycard","network.bluetooth","network.wlan","network.3gpp"],screen:{width:360,height:400},viewPort:{portrait:{width:360,height:400,paddingTop:0,paddingLeft:0}},ppi:199,userAgent:"Mozilla/5.0 (BlackBerry; U; BlackBerry 9670; en) AppleWebKit/534.3+ (KHTML, like Gecko) Version/6.0.0.286 Mobile Safari/534.3+",platforms:["web","cordova","webworks.handset"]}});ripple.define("devices/Tattoo",function(ripple,exports,module){module.exports={id:"Tattoo",name:"HTC Tattoo",manufacturer:"HTC",model:"Tattoo",osVersion:"1.6",uuid:"6F196F23-FD0D-4F62-B27B-730147FCC5A3",osName:"Android",screen:{width:240,height:320},viewPort:{portrait:{width:240,height:320,paddingTop:0,paddingLeft:0}},ppi:143,userAgent:"Mozilla/5.0 (Linux; U; Android 1.6; en-us; HTC_TATTOO_A3288 Build/DRC79) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1",platforms:["web","cordova"]}});ripple.define("devices/Torch9800",function(ripple,exports,module){module.exports={id:"Torch9800",name:"BlackBerry Torch 9800",model:"9800",osName:"BlackBerry OS",uuid:"42",osVersion:"6",manufacturer:"BlackBerry",capabilities:["input.touch","location.gps","location.maps","media.audio.capture","media.video.capture","media.recording","storage.memorycard","network.bluetooth","network.wlan","network.3gpp"],screen:{width:360,height:480},viewPort:{portrait:{width:360,height:480,paddingTop:0,paddingLeft:0},landscape:{width:480,height:360,paddingTop:0,paddingLeft:0}},ppi:186,userAgent:"Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en) AppleWebKit/534.1+ (KHTML, Like Gecko) Version/6.0.0.141 Mobile Safari/534.1",platforms:["web","cordova","webworks.handset"]}});ripple.define("devices/Torch9810",function(ripple,exports,module){module.exports={id:"Torch9810",name:"BlackBerry Torch 9810",model:"9810",osName:"BlackBerry OS",uuid:"42",osVersion:"7",manufacturer:"BlackBerry",capabilities:["input.touch","location.gps","location.maps","media.audio.capture","media.video.capture","media.recording","storage.memorycard","network.bluetooth","network.wlan","network.3gpp"],screen:{width:480,height:640},viewPort:{portrait:{width:480,height:640,paddingTop:0,paddingLeft:0},landscape:{width:640,height:480,paddingTop:0,paddingLeft:0}},ppi:253,userAgent:"Mozilla/5.0 (BlackBerry; U; BlackBerry 9810; en) AppleWebKit/534.1+ (KHTML, Like Gecko) Version/7.0.0.0 Mobile Safari/534.1",platforms:["web","cordova","webworks.handset"]}});ripple.define("devices/Torch9860-9850",function(ripple,exports,module){module.exports={id:"Torch9860-9850",name:"BlackBerry Torch 9860/9850",model:"9860-9850",osName:"BlackBerry OS",uuid:"42",osVersion:"7",manufacturer:"BlackBerry",capabilities:["input.touch","location.gps","location.maps","media.audio.capture","media.video.capture","media.recording","storage.memorycard","network.bluetooth","network.wlan","network.3gpp"],screen:{width:480,height:800},viewPort:{portrait:{width:480,height:800,paddingTop:0,paddingLeft:0},landscape:{width:800,height:480,paddingTop:0,paddingLeft:0}},ppi:253,userAgent:"Mozilla/5.0 (BlackBerry; U; BlackBerry 9860; en) AppleWebKit/534.1+ (KHTML, Like Gecko) Version/7.0.0.0 Mobile Safari/534.1",platforms:["web","cordova","webworks.handset"]}});ripple.define("devices/WQVGA",function(ripple,exports,module){module.exports={id:"WQVGA",name:"Generic - WQVGA (240x480)",osName:"Generic",osVersion:"Generic",manufacturer:"Generic",model:"Generic",uuid:"42",screen:{width:240,height:400},viewPort:{portrait:{width:240,height:480,paddingTop:0,paddingLeft:0},landscape:{width:480,height:240,paddingTop:0,paddingLeft:0}},ppi:96,platforms:["web","cordova"]}});ripple.define("devices/WVGA",function(ripple,exports,module){module.exports={id:"WVGA",name:"Generic - WVGA (480x800)",osName:"Generic",osVersion:"Generic",manufacturer:"Generic",model:"Generic",uuid:"42",screen:{width:480,height:800},viewPort:{portrait:{width:480,height:800,paddingTop:0,paddingLeft:0},landscape:{width:800,height:480,paddingTop:0,paddingLeft:0}},ppi:96,platforms:["web","cordova"]}});ripple.define("devices/Wave",function(ripple,exports,module){module.exports={id:"Wave",name:"Samsung Wave",manufacturer:"Samsung",model:"Wave",osName:"Bada",osVersion:"n/a",screen:{width:480,height:800},viewPort:{portrait:{width:480,height:800,paddingTop:0,paddingLeft:0},landscape:{width:800,height:480,paddingTop:0,paddingLeft:0}},ppi:282,userAgent:"?",platforms:["web"]}});ripple.define("devices/Z10",function(ripple,exports,module){module.exports={id:"Z10",name:"BlackBerry Z10",model:"Z10",osName:"BlackBerry",uuid:"42",osVersion:"10.0.10",manufacturer:"BlackBerry",hardwareId:"0x04002607",capabilities:["input.touch","location.gps","media.audio.capture","media.video.capture","media.recording","network.bluetooth","network.wlan"],screen:{width:768,height:1280},viewPort:{portrait:{width:768,height:1280,paddingTop:0,paddingLeft:0},landscape:{width:1280,height:768,paddingTop:0,paddingLeft:0}},defaultOrientation:"portrait",ppi:356,userAgent:"Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.10.261 Mobile Safari/537.10+",platforms:["web","webworks.bb10","cordova"],mediaQueryEmulation:{"-webkit-device-pixel-ratio":2.24}}});ripple.define("devices/iPad",function(ripple,exports,module){module.exports={id:"iPad",name:"iPad",model:"iPad",osName:"iOS",uuid:"e0101010d38bde8e6740011221af335301010333",osVersion:"1.6",manufacturer:"Apple",screen:{width:768,height:1024},viewPort:{portrait:{width:768,height:1024,paddingTop:0,paddingLeft:0},landscape:{width:1024,height:768,paddingTop:0,paddingLeft:0}},ppi:132,userAgent:"Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B367 Safari/531.21.10",platforms:["web","cordova"],notes:{1:'<a href="http://www.apple.com/ipad/specs/" target="_blank">Specs</a>'}}});ripple.define("devices/iPad3",function(ripple,exports,module){module.exports={id:"iPad3",name:"iPad 3",model:"iPad3",osName:"iOS",uuid:"e0101010d38bde8e6740011221af335301010334",osVersion:"5",manufacturer:"Apple",screen:{width:1536,height:2048},viewPort:{portrait:{width:1536,height:2048,paddingTop:0,paddingLeft:0},landscape:{width:2048,height:1536,paddingTop:0,paddingLeft:0}},ppi:264,userAgent:"Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B367 Safari/531.21.10",platforms:["web","cordova"],notes:{1:'<a href="http://www.apple.com/ipad/specs/" target="_blank">Specs</a>'},mediaQueryEmulation:{"-webkit-device-pixel-ratio":2}}});ripple.define("devices/iPhone3",function(ripple,exports,module){module.exports={id:"iPhone3",name:"iPhone 3G/3Gs",model:"3G",osName:"iPhone",osVersion:"3",uuid:"e0101010d38bde8e6740011221af335301010333",manufacturer:"Apple",screen:{width:320,height:480},viewPort:{portrait:{width:320,height:480,paddingTop:0,paddingLeft:0},landscape:{width:480,height:320,paddingTop:0,paddingLeft:0}},ppi:163,userAgent:"Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/1A542a Safari/419.3",platforms:["web","cordova"]}});ripple.define("devices/iPhone4",function(ripple,exports,module){module.exports={id:"iPhone4",name:"iPhone 4/4s",model:"4s",osName:"iOS",osVersion:"5",uuid:"e0101010d38bde8e6740011221af335301010333",manufacturer:"Apple",screen:{width:640,height:960},viewPort:{portrait:{width:640,height:960,paddingTop:0,paddingLeft:0},landscape:{width:960,height:640,paddingTop:0,paddingLeft:0}},ppi:326,userAgent:"Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/1A542a Safari/419.3",platforms:["web","cordova"],mediaQueryEmulation:{"-webkit-device-pixel-ratio":2}}});ripple.define("devices/iPhone5",function(ripple,exports,module){module.exports={id:"iPhone5",name:"iPhone 5",model:"5",osName:"iOS",osVersion:"6",uuid:"e0101010d38bde8e6740011221af335301010333",manufacturer:"Apple",screen:{width:640,height:1136},viewPort:{portrait:{width:640,height:1136,paddingTop:0,paddingLeft:0},landscape:{width:1136,height:640,paddingTop:0,paddingLeft:0}},ppi:326,userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3",platforms:["web","cordova"],mediaQueryEmulation:{"-webkit-device-pixel-ratio":2}}});ripple.define("devices",function(ripple,exports,module){var _self,db=ripple("db"),utils=ripple("utils"),platform=ripple("platform"),event=ripple("event"),_devices={};event.on("HardwareKeyDefault",function(key){if(key===0||key==="0"){ripple("emulatorBridge").window().history.back()}});function _getRequestedDevice(){return(utils.queryString().enableripple||"").split("-")[2]}_self=module.exports={initialize:function(){_devices=["AcerA500","Bold9700","Bold9900","Q10","Z10","Curve9300","Curve9350-9360-9370","FWVGA","G1","HPPre3","HPVeer","HVGA","iPad","iPad3","iPhone3","iPhone4","iPhone5","Legend","Nexus","NexusS","NexusGalaxy","Nexus7","Nexus4","NokiaN8","NokiaN97","PalmPre","PalmPre2","Pearl9100","Playbook","QVGA","Style9670","Tattoo","Torch9800","Torch9810","Torch9860-9850","Wave","WQVGA","WVGA"].reduce(function(hash,deviceID){hash[deviceID.toLowerCase()]=ripple("devices/"+deviceID);return hash},{});var current=this.getCurrentDevice();ripple("bus").send("userAgent",current.userAgent)},getCurrentDevice:function(){var deviceId=_getRequestedDevice()||db.retrieve("device-key"),device=this.getDevice(deviceId),platformId=platform.current().id,does=function(device){return{include:function(platformId){return device.platforms.some(function(id){return platformId===id})}}};if(!device||!does(device).include(platformId)){deviceId=utils.reduce(_devices,function(current,device,id){return does(device).include(platformId)?id:current});device=this.getDevice(deviceId)}return device},getDevice:function(deviceId){return utils.copy(_devices[(deviceId||"").toLowerCase()])},getDevicesForPlatform:function(platformId){return utils.filter(_devices,function(device){return device.platforms.indexOf(platformId)>-1})}}});ripple.define("emulatorBridge",function(ripple,exports,module){var platform=ripple("platform"),builder=ripple("platform/builder"),utils=ripple("utils"),_xhr,_win,_doc;function _getEmulatedViewportStyle(attr){var vp=document.getElementById("viewport-container");return vp["client"+attr]}function _screenAvailWidth(){return _getEmulatedViewportStyle("Width")}function _screenAvailHeight(){return _getEmulatedViewportStyle("Height")}function _screenWidth(){return _getEmulatedViewportStyle("Width")}function _screenHeight(){return _getEmulatedViewportStyle("Height")}function _window_innerWidth(){return _getEmulatedViewportStyle("Width")}function _window_innerHeight(){return _getEmulatedViewportStyle("Height")}function _marshalScreen(win){utils.forEach({availWidth:_screenAvailWidth,availHeight:_screenAvailHeight,width:_screenWidth,height:_screenHeight},function(mappedFunc,prop){win.screen.__defineGetter__(prop,mappedFunc)});utils.forEach({innerWidth:_window_innerWidth,innerHeight:_window_innerHeight},function(mappedFunc,prop){win.__defineGetter__(prop,mappedFunc)})}module.exports={init:function(win,doc){_win=win;_doc=doc;_xhr=win.XMLHttpRequest;function marshal(obj,key){var existingDescriptor=Object.getOwnPropertyDescriptor(window,key);Object.defineProperty(window,key,{get:function(){return obj},set:function(newValue){obj=newValue},configurable:existingDescriptor?existingDescriptor.configurable:true,enumerable:existingDescriptor?existingDescriptor.enumerable:true});existingDescriptor=Object.getOwnPropertyDescriptor(win,key);Object.defineProperty(win,key,{get:function(){return obj},set:function(newValue){obj=newValue},configurable:existingDescriptor?existingDescriptor.configurable:true,enumerable:existingDescriptor?existingDescriptor.enumerable:true})}var currentPlatform=platform.current(),sandbox={};marshal(window.tinyHippos,"tinyHippos");marshal(window.XMLHttpRequest,"XMLHttpRequest");if(currentPlatform.initialize){currentPlatform.initialize(win)}builder.build(platform.current().objects).into(sandbox);utils.forEach(sandbox,marshal);_marshalScreen(win);_marshalScreen(window)},document:function(){return _doc},window:function(){return _win},xhr:function(){return _xhr}}});ripple.define("event",function(ripple,exports,module){var utils=ripple("utils"),exception=ripple("exception"),_listeners={};function _on(eventType,listener,scope,once){if(!eventType){throw"eventType must be truthy"}_listeners[eventType]=_listeners[eventType]||[];_listeners[eventType].push({func:listener,scope:scope,once:!!once})}function _trigger(listener,args,sync){try{if(sync){listener.func.apply(listener.scope,args)}else{setTimeout(function(){listener.func.apply(listener.scope,args)},1)}}catch(e){exception.handle(e)}}module.exports={on:function(eventType,listener,scope){_on(eventType,listener,scope,false)},once:function(eventType,listener,scope){_on(eventType,listener,scope,true)},trigger:function(eventType,args,sync){args=args||[];sync=sync||false;var listeners=_listeners[eventType];if(listeners){listeners.forEach(function(listener){_trigger(listener,args,sync)});_listeners[eventType]=listeners.filter(function(listener){return!listener.once})}},eventHasSubscriber:function(eventType){return!!_listeners[eventType]},getEventSubscribers:function(eventType){return utils.copy(_listeners[eventType])||[]},clear:function(eventType){if(eventType){delete _listeners[eventType]}}}});ripple.define("exception",function(ripple,exports,module){var _console=ripple("console");function _getStack(depth){var caller,stack="",count=0;try{caller=arguments.callee.caller.arguments.callee.caller;while(count<=depth&&caller){stack+="function: "+caller.toString().match(/function\s?(.*)\{/)[1]+"\n";caller=caller.arguments.callee.caller;count++}}catch(e){stack="failed to determine stack trace ("+(e.name||e.type)+" :: "+e.message+")"}return stack}module.exports={types:{Application:"Application",ArgumentLength:"ArgumentLength",ArgumentType:"ArgumentType",Argument:"Argument",NotificationType:"NotificationType",NotificationStateType:"NotificationStateType",DomObjectNotFound:"DomObjectNotFound",LayoutType:"LayoutType",DeviceNotFound:"DeviceNotFound",tinyHipposMaskedException:"tinyHipposMaskedException",Geo:"Geo",Accelerometer:"Accelerometer",MethodNotImplemented:"MethodNotImplemented",InvalidState:"InvalidState",ApplicationState:"ApplicationState"},handle:function handle(exception,reThrow){reThrow=reThrow||false;var eMsg=exception.message||"exception caught!",msg=eMsg+"\n\n"+(exception.stack||"*no stack provided*")+"\n\n";_console.error(msg);if(reThrow){throw exception}},raise:function raise(exceptionType,message,customExceptionObject){var obj=customExceptionObject||{type:"",message:"",toString:function(){var result=this.name+': "'+this.message+'"';if(this.stack){result+="\n"+this.stack}return result}};message=message||"";obj.name=exceptionType;obj.type=exceptionType;obj.message=message;obj.stack=_getStack(5);throw obj}}});ripple.define("fs",function(ripple,exports,module){var utils=ripple("utils"),constants=ripple("constants"),event=ripple("event"),_console=ripple("console"),PLAIN_TEXT="text/plain",_fs={temp:undefined,perm:undefined},_self,_resolveLocalFileSystemURL;function _map(array,callback){var map=[],i;for(i=0;i<array.length;i++){map[i]=callback(array[i],i)}return map}function _error(e,baton){var msg="";switch(e.code){case FileError.QUOTA_EXCEEDED_ERR:msg="QUOTA_EXCEEDED_ERR";break;case FileError.NOT_FOUND_ERR:msg="NOT_FOUND_ERR";break;case FileError.SECURITY_ERR:msg="SECURITY_ERR: Looks like you're running in the file:/// scheme. You need to start Chrome with --allow-file-access-from-files if you want to have access to the FileSystem API.";break;case FileError.INVALID_MODIFICATION_ERR:msg="INVALID_MODIFICATION_ERR";break;case FileError.INVALID_STATE_ERR:msg="INVALID_STATE_ERR";break;default:msg="Unknown Error";break}_console.log("FileSystem error: "+msg);baton.pass()}_self={initialize:function(prev,baton){try{var requestFileSystem=window.webkitRequestFileSystem||window.requestFileSystem;_resolveLocalFileSystemURL=window.webkitResolveLocalFileSystemURL||window.resolveLocalFileSystemURL;if(requestFileSystem){baton.take()}requestFileSystem(window.TEMPORARY,constants.FS_SIZE,function(fs){_fs.temp=fs;requestFileSystem(window.PERSISTENT,constants.FS_SIZE,function(fs){_fs.perm=fs;event.trigger("FileSystemInitialized",null,true);baton.pass()},function(e){_error(e,baton)})},function(e){_error(e,baton)})}catch(e){console.log("File System Not Available");baton.pass()}},ls:function(path,success,error,options){options=options||{};var fs=options.perm?_fs.perm:_fs.temp;path=path||"/";fs.root.getDirectory(path,{},function(dirEntry){var dirReader=dirEntry.createReader();dirReader.readEntries(function(entries){success(_map(entries,function(entry){return entry}))},error)},error)},rm:function(path,success,error,options){options=options||{};var fs=options.perm?_fs.perm:_fs.temp;fs.root[options.recursive?"getDirectory":"getFile"](path,{create:false},function(entry){entry[options.recursive?"removeRecursively":"remove"](function(){success()},error)},error)},rmdir:function(path,success,error,options){options=options||{};var fs=options.perm?_fs.perm:_fs.temp;fs.root.getDirectory(path,{create:false},function(entry){entry.remove(function(){success()},error)},error)},mkdir:function(path,success,error,options){options=options||{};var fs=options.perm?_fs.perm:_fs.temp,order=jWorkflow.order(),chunks=path.replace(/^\//,"").split("/"),currentPath="";if(options.recursive){delete options.recursive;chunks.forEach(function(piece){var thisPath=(currentPath?currentPath+"/":"")+piece;currentPath=thisPath;order.andThen(function(p,baton){baton.take();_self.mkdir(thisPath,function(){baton.pass()},error,options)})});order.start(function(){_self.stat(path,success,error,options)})}else{fs.root.getDirectory(path,{create:true},function(dirEntry){success(dirEntry)},error)}},mv:function(from,to,success,error,options){var path=to.replace(/^\//,"").split("/"),fileName=path.splice(path.length-1,1).toString();_self.stat(from,function(entry){_self.stat(path.length>0?path.join("/"):"/",function(dest){entry.moveTo(dest,fileName,function(finalDestination){success(finalDestination)},error)},error,options)},error,options)},touch:function(path,success,error,options){options=options||{};var fs=options.perm?_fs.perm:_fs.temp;fs.root.getFile(path,{create:true},function(fileEntry){success(fileEntry)},error)},cp:function(from,to,success,error,options){var path=to.replace(/^\//,"").split("/"),fileName=path.splice(path.length-1,1).toString();
_self.stat(from,function(entry){_self.stat(path.length>0?path.join("/"):"/",function(dest){entry.copyTo(dest,fileName,function(finalDestination){success(finalDestination)},error)},error,options)},error,options)},stat:function(path,success,error,options){options=options||{};var fs=options.perm?"/persistent/":"/temporary/",url="filesystem:"+utils.location().origin+fs+path;_resolveLocalFileSystemURL(url,function(entry){success(entry)},error)},write:function(path,contents,success,error,options){options=options||{};function write(entry){entry.createWriter(function(fileWriter){var blob=contents instanceof Blob===false?new Blob([contents],{type:options.type||PLAIN_TEXT}):contents;fileWriter.onerror=error;fileWriter.onwriteend=function(){success(entry)};if(options.mode==="append"){fileWriter.seek(fileWriter.length)}fileWriter.write(blob)},error)}_self.stat(path,function(entry){if(options.mode==="append"){write(entry)}else{_self.rm(path,function(){_self.touch(path,write,error,options)},error,options)}},function(e){if(e.code===FileError.NOT_FOUND_ERR){_self.touch(path,write,error,options)}else{error(e)}},options)},read:function(path,success,error,options){if(!options){options={}}_self.stat(path,function(entry){entry.file(function(file){var reader=new FileReader;reader.onerror=error;if(options.type==="text"){reader.onloadend=function(progressEvent){success(progressEvent.target.result)};reader.readAsText(file)}else{success(new Blob([file],{type:file.type}))}},error)},error,options)}};module.exports=_self});ripple.define("geo",function(ripple,exports,module){var db=ripple("db"),exception=ripple("exception"),event=ripple("event"),utils=ripple("utils"),_positionInfo={latitude:43.465187,longitude:-80.522372,altitude:100,accuracy:150,altitudeAccuracy:80,heading:0,speed:0,cellID:321654},self;function _serialize(settings){var tempSettings=utils.copy(settings);tempSettings.position.timeStamp="new Date("+tempSettings.position.timeStamp.getTime()+")";return tempSettings}function _validatePositionInfo(pInfo){return pInfo&&!(isNaN(pInfo.latitude)||isNaN(pInfo.longitude)||isNaN(pInfo.altitude)||isNaN(pInfo.accuracy)||isNaN(pInfo.altitudeAccuracy)||isNaN(pInfo.heading)||isNaN(pInfo.speed)||isNaN(pInfo.cellID))?true:false}self=module.exports={initialize:function(){var settings=db.retrieveObject("geosettings");if(settings){utils.forEach(_positionInfo,function(value,key){_positionInfo[key]=parseFloat(settings.position[key]||value)});self.timeout=settings.timeout;self.delay=settings.delay||0}},getPositionInfo:function(){var pi=utils.copy(_positionInfo);pi.timeStamp=new Date;return pi},updatePositionInfo:function(newPositionInfo,delay,timeout){if(!_validatePositionInfo(newPositionInfo)){exception.raise(exception.types.Geo,"invalid positionInfo object")}_positionInfo=utils.copy(newPositionInfo);_positionInfo.timeStamp=new Date;self.delay=delay||0;self.timeout=timeout;db.saveObject("geosettings",_serialize({position:_positionInfo,delay:self.delay,timeout:self.timeout}));event.trigger("PositionInfoUpdatedEvent",[_positionInfo])},timeout:false,delay:0,map:{}}});ripple.define("honeypot",function(ripple,exports,module){var noop=function(){};module.exports={monitor:function(context,target){var setup=function(get,set){set=set||noop;context.__defineGetter__(target,noop);context.__defineSetter__(target,function(value){context.__defineGetter__(target,get);set(value)})};return{andReturn:function(value){setup(function(){return value})},andRun:function(get,set){setup(get,set)}}}}});ripple.define("index",function(ripple,exports,module){var omgwtf=ripple("omgwtf"),db=ripple("db"),xhr=ripple("xhr"),geo=ripple("geo"),fs=ripple("fs"),platform=ripple("platform"),emulatorBridge=ripple("emulatorBridge"),devices=ripple("devices"),_console=ripple("console"),widgetConfig=ripple("widgetConfig"),deviceSettings=ripple("deviceSettings"),ui=ripple("ui"),appcache=ripple("appcache"),_self;function checkForRepeatReload(){var time=(new Date).getTime(),lastLoad=JSON.parse(window.localStorage["ripple-last-load"]||null)||{time:time,counter:0};if(time-lastLoad.time<3e3){if(lastLoad.counter>=3){window.onbeforeunload=function(){return"Looks like the page you're on is trying to break out of an iFram. To stop this behaviour, click 'stay on this page'. To continue, click 'leave this page'."};lastLoad={time:time,counter:0}}else{lastLoad={time:time,counter:lastLoad.counter+1}}}else{lastLoad={time:time,counter:0}}window.localStorage["ripple-last-load"]=JSON.stringify(lastLoad)}function setUserAgent(prev,baton){if(document.getElementById("tinyhippos-injected")){return}baton.take();var xhr=new XMLHttpRequest,userAgent=devices.getCurrentDevice().userAgent,params;params="userAgent="+(userAgent?escape(userAgent):"");xhr.open("POST","ripple/user-agent");xhr.onreadystatechange=function(){if(xhr.readyState===4){if(xhr.status!==200){_console.log("Setting the user agent server side failed.")}baton.pass()}};xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");xhr.send(params)}_self={boot:function(booted){window.addEventListener("keydown",function(event){var hasMetaOrAltPressed=event.metaKey||event.ctrlKey,key=parseInt(event.keyCode,10);if(key===37&&hasMetaOrAltPressed){event.preventDefault();emulatorBridge.window().history.back()}if(key===39&&hasMetaOrAltPressed){event.preventDefault();emulatorBridge.window().history.forward()}if(key===82&&hasMetaOrAltPressed){event.preventDefault();emulatorBridge.window().location.reload()}if(key===116){event.preventDefault();emulatorBridge.window().location.reload()}});checkForRepeatReload();jWorkflow.order(omgwtf.initialize,omgwtf).andThen(appcache.initialize,appcache).andThen(db.initialize,db).andThen(xhr.initialize,xhr).andThen(geo.initialize,geo).andThen(fs.initialize,fs).andThen(platform.initialize,platform).andThen(devices.initialize,devices).andThen(setUserAgent).andThen(widgetConfig.initialize,widgetConfig).andThen(deviceSettings.initialize,deviceSettings).andThen(ui.initialize,ui).start(booted)}};module.exports=_self});ripple.define("notifications",function(ripple,exports,module){var constants=ripple("constants"),exception=ripple("exception");function _validateAndInitNType(nType){nType=nType||"normal";if(nType!=="normal"&&nType!=="error"){exception.raise(exception.types.NotificationType,"Unknown Notification Type == "+nType+",when dealing with Console notification.")}return nType}function _processNotification(nType,stateType,message){nType=_validateAndInitNType(nType);message=message||"";var display,displayText,className,notificationIcon,box=document.getElementById(constants.NOTIFICATIONS.MAIN_CONTAINER_CLASS),msgBox=document.getElementById(constants.NOTIFICATIONS.MESSAGE_TEXT_CONTAINER_CLASS);className="ui-widget";switch(stateType){case constants.NOTIFICATIONS.STATE_TYPES.CLOSE:display="display: none;";displayText="";break;case constants.NOTIFICATIONS.STATE_TYPES.OPEN:display="display: block;";displayText=message;if(nType==="error"){displayText="Oh Snap!\n\n"+displayText;className+=" ui-state-error ui-corner-all";notificationIcon='<span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>'}else{className+=" ui-state-highlight ui-corner-all";notificationIcon='<span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>'}break;default:exception.raise(exception.types.NotificationStateType,"Unknown StateType == "+stateType.toString())}msgBox.innerHTML=notificationIcon+displayText;box.setAttribute("class",className);box.setAttribute("style",display)}function _processConfirm(message,resultCallback,title,buttonLabels){buttonLabels=buttonLabels||"";message=message||"";title=title||"Confirm";var btnArray=[];var buttons=[];if($.isArray(buttonLabels)){btnArray=buttonLabels}else{btnArray=!buttonLabels||0===buttonLabels.length?[]:buttonLabels.split(",")}btnArray.forEach(function(btnLabel,index){var button={};button["text"]=btnLabel;button["click"]=function(){if(typeof resultCallback!=="undefined"){resultCallback(index+1)}jQuery(this).dialog("close")};buttons.push(button)});var dialogBox=jQuery("#confirm-dialog");dialogBox.dialog("option","title",title);jQuery("#confirm-message").text(message);dialogBox.dialog("open");if(btnArray.length>0){dialogBox.dialog("option","buttons",buttons);return}var closeBox=function(){dialogBox.dialog("close")};jQuery("#confirm-cancel").button().unbind().bind("click",closeBox).show();jQuery("#confirm-ok").button().unbind().bind("click",closeBox).show()}module.exports={openNotification:function(nType,msg){_processNotification(nType,constants.NOTIFICATIONS.STATE_TYPES.OPEN,msg)},closeNotification:function(nType){_processNotification(nType,constants.NOTIFICATIONS.STATE_TYPES.CLOSE)},confirmNotification:function(message,resultCallback,title,buttonLabels){_processConfirm(message,resultCallback,title,buttonLabels)}}});ripple.define("omgwtf",function(ripple,exports,module){var event=ripple("event"),db=ripple("db"),_loaded=false,_self;function _delay(action){window.setTimeout(function(){if(!_loaded){if(jQuery(".first-run-window").is(":visible")){_delay(action)}else{action()}}},1e4)}function _hide(){jQuery(".error-window").css({display:"none"});jQuery(".error-dialog").css({display:"none"})}function _show(){jQuery(".error-window").css({display:"block"});jQuery(".error-dialog").css({display:"block",left:jQuery(document).width()/2-277+"px"});jQuery("#error-wait").click(function(){_hide();_delay(_show)});jQuery("#error-panic").click(function(){db.removeAll(function(){localStorage.clear();location.reload()})})}_delay(_show);_self={initialize:function(){event.on("TinyHipposLoaded",function(){_loaded=true})},show:_show,hide:_hide};module.exports=_self});ripple.define("platform/builder",function(ripple,exports,module){var utils=ripple("utils"),app=ripple("app");function _objectFactory(context,objects,allowed){utils.forEach(objects,function(obj,key){var result={};if(allowed(obj)){result=obj.path?window.ripple("platform/"+obj.path):{}}if(obj.children){_objectFactory(result,obj.children,allowed)}if(allowed(obj)||utils.count(result)){context[key]=result}else{delete context[key]}})}module.exports={build:function(objects){return{into:function(sandbox){var features=utils.copy(app.getInfo().features),allowed=function(obj){var contains=function(requirements){return requirements.split("|").some(function(feature){return!!features[feature]})};return!obj.feature||!features||features&&contains(obj.feature)};_objectFactory(sandbox,objects,allowed)}}}}});ripple.define("platform/cordova/1.0.0/AVCodecsAttributes",function(ripple,exports,module){module.exports=function(info,id,audioCodecs,videoCodecs){return{info:info,id:id,audioCodecs:audioCodecs,videoCodecs:videoCodecs}}});ripple.define("platform/cordova/1.0.0/Acceleration",function(ripple,exports,module){module.exports=function(x,y,z){return{x:x||0,y:y||0,z:z||0,timestamp:(new Date).getTime()}}});ripple.define("platform/cordova/1.0.0/AudioCodecAttributes",function(ripple,exports,module){module.exports=function(info,id,compFormats,encode,decode){return{info:info,id:id,compFormats:compFormats,encode:encode,decode:decode}}});ripple.define("platform/cordova/1.0.0/AudioDeviceAttributes",function(ripple,exports,module){module.exports=function(type,freqRangeLow,freqRangeHigh,volumeLevel,info){return{type:type,freqRangeLow:freqRangeLow,freqRangeHigh:freqRangeHigh,volumeLevel:volumeLevel,info:info}}});ripple.define("platform/cordova/1.0.0/BrailleDeviceAttributes",function(ripple,exports,module){module.exports=function(nbCells,info){return{nbCells:nbCells,info:info}}});ripple.define("platform/cordova/1.0.0/CPUAttributes",function(ripple,exports,module){module.exports=function(info,id,usage){return{info:info,id:id,usage:usage}}});ripple.define("platform/cordova/1.0.0/CameraAttributes",function(ripple,exports,module){module.exports=function(supportsVideo,hasFlash,sensorPixels,maxZoomFactor){return{supportsVideo:supportsVideo,hasFlash:hasFlash,sensorPixels:sensorPixels,maxZoomFactor:maxZoomFactor}}});ripple.define("platform/cordova/1.0.0/Connection",function(ripple,exports,module){module.exports={UNKNOWN:"unknown",ETHERNET:"ethernet",WIFI:"wifi",CELL_2G:"2g",CELL_3G:"3g",CELL_4G:"4g",NONE:"none"}});ripple.define("platform/cordova/1.0.0/ConnectionAttributes",function(ripple,exports,module){module.exports=function(info,id,type,currentOrientation,currentUploadBandwidth,maxDownloadBandwidth,maxUploadBandwidth,currentSignalStrength,roaming){return{info:info,id:id,type:type,currentDownloadBandwidth:currentOrientation,currentUploadBandwidth:currentUploadBandwidth,maxDownloadBandwidth:maxDownloadBandwidth,maxUploadBandwidth:maxUploadBandwidth,currentSignalStrength:currentSignalStrength,roaming:roaming}}});ripple.define("platform/cordova/1.0.0/Contact",function(ripple,exports,module){var utils=ripple("utils"),event=ripple("event");function _properties(obj){var prop,newObj={};for(prop in obj){if(Object.prototype.hasOwnProperty.call(obj,prop)){if(typeof obj[prop]!=="function"){newObj[prop]=utils.copy(obj[prop])}}}return newObj}module.exports=function(id,displayName,name,nickname,phoneNumbers,emails,addresses,ims,organizations,birthday,note,photos,categories,urls){return{id:id||Math.uuid(undefined,16),displayName:displayName||null,name:name||null,nickname:nickname||null,phoneNumbers:phoneNumbers||null,emails:emails||null,addresses:addresses||null,ims:ims||null,organizations:organizations||null,birthday:birthday||null,note:note||null,photos:photos||null,categories:categories||null,urls:urls||null,save:function(success,error){var _self=this,lastUpdated=this.updated;this.updated=new Date;if(!this.id){this.id=Math.uuid(undefined,16)}event.trigger("phonegap-contact-save",[_properties(this),success,function(e){_self.updated=lastUpdated;error(e)}])},remove:function(success,error){event.trigger("phonegap-contact-remove",[this.id,success,error])},clone:function(){var copy=utils.copy(this);copy.id=null;return copy}}}});ripple.define("platform/cordova/1.0.0/ContactAccount",function(ripple,exports,module){module.exports=function(domain,username,userid){return{domain:domain,username:username,userid:userid}}});ripple.define("platform/cordova/1.0.0/ContactAddress",function(ripple,exports,module){module.exports=function(pref,type,formatted,streetAddress,locality,region,postalCode,country,id){return{pref:pref||null,type:type||null,formatted:formatted||null,streetAddress:streetAddress||null,locality:locality||null,region:region||null,postalCode:postalCode||null,country:country||null,id:id||null}}});ripple.define("platform/cordova/1.0.0/ContactError",function(ripple,exports,module){function ContactError(code){this.code=code||null}ContactError.UNKNOWN_ERROR=0;ContactError.INVALID_ARGUMENT_ERROR=1;ContactError.NOT_FOUND_ERROR=2;ContactError.TIMEOUT_ERROR=3;ContactError.PENDING_OPERATION_ERROR=4;ContactError.IO_ERROR=5;ContactError.NOT_SUPPORTED_ERROR=6;ContactError.PERMISSION_DENIED_ERROR=20;module.exports=ContactError});ripple.define("platform/cordova/1.0.0/ContactField",function(ripple,exports,module){module.exports=function(type,value,pref){return{type:type,value:value,pref:pref||false}}});ripple.define("platform/cordova/1.0.0/ContactFindOptions",function(ripple,exports,module){module.exports=function(filter,multiple,updatedSince){return{filter:filter||"",multiple:multiple||false,updatedSince:updatedSince||""}}});ripple.define("platform/cordova/1.0.0/ContactName",function(ripple,exports,module){module.exports=function(formatted,familyName,givenName,middleName,honorificPrefix,honorificSuffix){return{formatted:formatted,familyName:familyName,givenName:givenName,middleName:middleName,honorificPrefix:honorificPrefix,honorificSuffix:honorificSuffix}}});ripple.define("platform/cordova/1.0.0/ContactOrganization",function(ripple,exports,module){module.exports=function(pref,type,name,dept,title){return{pref:pref||null,type:type||null,name:name||null,department:dept||null,title:title||null}}});ripple.define("platform/cordova/1.0.0/DisplayDeviceAttributes",function(ripple,exports,module){module.exports=function(orientation,brightness,contrast,blanked,dotsPerInchW,dotsPerInchH,physicalWidth,physicalHeight,info){return{orientation:orientation,brightness:brightness,contrast:contrast,blanked:blanked,dotsPerInchW:dotsPerInchW,dotsPerInchH:dotsPerInchH,physicalWidth:physicalWidth,physicalHeight:physicalHeight,info:info}}});ripple.define("platform/cordova/1.0.0/InputDevicesAttributes",function(ripple,exports,module){module.exports=function(info,id,pointingDevices,activePointingDevices,keyboards,activeKeyboards,cameras,activeCameras,microphones,activeMicrophones){return{info:info,id:id,pointingDevices:pointingDevices,activePointingDevices:activePointingDevices,keyboards:keyboards,activeKeyboards:activeKeyboards,cameras:cameras,activeCameras:activeCameras,microphones:microphones,activeMicrophones:activeMicrophones}}});ripple.define("platform/cordova/1.0.0/KeyboardAttributes",function(ripple,exports,module){module.exports=function(type,isHardware,info){return{type:type,isHardware:isHardware,info:info}}});ripple.define("platform/cordova/1.0.0/MicrophoneAttributes",function(ripple,exports,module){module.exports=function(type,freqRangeLow,freqRangeHigh,info,name,types){return{type:type,freqRangeLow:freqRangeLow,freqRangeHigh:freqRangeHigh,info:info,name:name,types:types}}});ripple.define("platform/cordova/1.0.0/NetworkAttributes",function(ripple,exports,module){module.exports=function(info,id,activeConnections){return{info:info,id:id,activeConnections:activeConnections||[]}}});ripple.define("platform/cordova/1.0.0/NetworkStatus",function(ripple,exports,module){module.exports={NOT_REACHABLE:0,REACHABLE_VIA_CARRIER_DATA_NETWORK:1,REACHABLE_VIA_WIFI_NETWORK:2}});ripple.define("platform/cordova/1.0.0/OutputDevicesAttributes",function(ripple,exports,module){module.exports=function(info,id,displayDevices,activeDisplayDevices,printingDevices,activePrintingDevice,brailleDevices,activeBrailleDevice,audioDevices,activeAudioDevices){return{info:info,id:id,displayDevices:displayDevices,activeDisplayDevices:activeDisplayDevices,printingDevices:printingDevices,activePrintingDevice:activePrintingDevice,brailleDevices:brailleDevices,activeBrailleDevice:activeBrailleDevice,audioDevices:audioDevices,activeAudioDevices:activeAudioDevices}}});ripple.define("platform/cordova/1.0.0/PhoneGap",function(ripple,exports,module){module.exports={available:true}});ripple.define("platform/cordova/1.0.0/PointerAttributes",function(ripple,exports,module){module.exports=function(type,supportsMultiTouch,info){return{type:type,supportsMultiTouch:supportsMultiTouch,info:info}}});ripple.define("platform/cordova/1.0.0/PowerAttributes",function(ripple,exports,module){module.exports=function(info,id,level,timeRemaining,isBattery,isCharging){return{info:info,id:id,level:level,timeRemaining:timeRemaining,isBattery:isBattery,isCharging:isCharging}}});ripple.define("platform/cordova/1.0.0/PrintingDeviceAttributes",function(ripple,exports,module){module.exports=function(type,resolution,color,info){return{type:type,resolution:resolution,color:color,info:info}}});ripple.define("platform/cordova/1.0.0/SensorAttributes",function(ripple,exports,module){module.exports=function(value,min,max,normalizedValue){return{value:value,min:min,max:max,normalizedValue:normalizedValue}}});ripple.define("platform/cordova/1.0.0/StorageUnitAttributes",function(ripple,exports,module){module.exports=function(info,id,type,isWritable,capacity,availableCapacity,isRemoveable){return{info:info,id:id,type:type,isWritable:isWritable,capacity:capacity,availableCapacity:availableCapacity,isRemoveable:isRemoveable}}});ripple.define("platform/cordova/1.0.0/SystemInfoOptions",function(ripple,exports,module){module.exports=function(highThreshold,lowThreshold,thresholdTarget,timeout,id){return{highThreshold:highThreshold,lowThreshold:lowThreshold,thresholdTarget:thresholdTarget,timeout:timeout,id:id}}});ripple.define("platform/cordova/1.0.0/ThermalAttributes",function(ripple,exports,module){module.exports=function(info,id,state){return{info:info,id:id,state:state}}});ripple.define("platform/cordova/1.0.0/VideoCodecAttributes",function(ripple,exports,module){module.exports=function(info,id,compFormats,containerFormats,hwAccel,profiles,frameTypes,rateTypes){return{info:info,id:id,compFormats:compFormats,containerFormats:containerFormats,hwAccel:hwAccel,profiles:profiles,frameTypes:frameTypes,rateTypes:rateTypes}}});ripple.define("platform/cordova/1.0.0/accelerometer",function(ripple,exports,module){var Acceleration=ripple("platform/cordova/1.0.0/Acceleration"),utils=ripple("utils"),event=ripple("event"),_accelerometerInfo=new Acceleration,_watches={},self;module.exports=self={getCurrentAcceleration:function(onSuccess){if(typeof onSuccess==="function"){setTimeout(function(){onSuccess(utils.copy(_accelerometerInfo))},1)}},watchAcceleration:function(accelerometerSuccess,accelerometerError,accelerometerOptions){var watchId=(new Date).getTime().toString(),watchObj={};if(accelerometerOptions&&accelerometerOptions.frequency&&typeof accelerometerOptions.frequency==="number"&&accelerometerOptions.frequency===Math.floor(accelerometerOptions.frequency)){watchObj={onSuccess:accelerometerSuccess,onError:accelerometerError,interval:accelerometerOptions.frequency};_watches[watchId]=watchObj;_watches[watchId].intervalId=setInterval(function(){self.getCurrentAcceleration(_watches[watchId].onSuccess,_watches[watchId].onError)},accelerometerOptions.frequency)}else{if(typeof accelerometerError==="function"){setTimeout(function(){accelerometerError()},1)}}return watchId},clearWatch:function(watchId){clearInterval(_watches[watchId].intervalId)}};event.on("AccelerometerInfoChangedEvent",function(accelerometerInfo){_accelerometerInfo.x=accelerometerInfo.accelerationIncludingGravity.x/9.8;_accelerometerInfo.y=accelerometerInfo.accelerationIncludingGravity.y/9.8;_accelerometerInfo.z=accelerometerInfo.accelerationIncludingGravity.z/9.8;_accelerometerInfo.timestamp=(new Date).getTime()})});ripple.define("platform/cordova/1.0.0/camera",function(ripple,exports,module){module.exports={getPicture:function(cameraSuccess,cameraError){if(cameraError){cameraError.apply(null,["not implemented"])}else{throw"not implemented"}}}});ripple.define("platform/cordova/1.0.0/compass",function(ripple,exports,module){var geo=ripple("geo");function _getHeading(){return geo.getPositionInfo().heading}module.exports={getCurrentHeading:function(compassSuccess){setTimeout(function(){compassSuccess(_getHeading())},1)},watchHeading:function(compassSuccess,compassError,compassOptions){compassOptions=compassOptions||{};return setInterval(function(){compassSuccess(_getHeading())},compassOptions.frequency||100)},clearWatch:function(success,error,args){clearInterval(args[0]);if(success&&typeof success==="function"){success()}}}});ripple.define("platform/cordova/1.0.0/contacts",function(ripple,exports,module){var Contact=ripple("platform/cordova/1.0.0/Contact"),ContactName=ripple("platform/cordova/1.0.0/ContactName"),ContactError=ripple("platform/cordova/1.0.0/ContactError"),ContactField=ripple("platform/cordova/1.0.0/ContactField"),utils=ripple("utils"),db=ripple("db"),event=ripple("event"),_defaultContacts=[{id:Math.uuid(undefined,16),name:new ContactName("Brent Lintner"),displayName:"Brent Lintner",emails:[new ContactField("work","brent@tinyhippos.com",false)]},{id:Math.uuid(undefined,16),name:new ContactName("PJ Lowe"),displayName:"PJ Lowe",emails:[new ContactField("work","pj@tinyhippos.com",false)]},{id:Math.uuid(undefined,16),name:new ContactName("Dan Silivestru"),displayName:"Dan Silivestru",emails:[new ContactField("work","dan@tinyhippos.com",false)]},{id:Math.uuid(undefined,16),name:new ContactName("Gord Tanner"),displayName:"Gord Tanner",emails:[new ContactField("work","gord@tinyhippos.com",true)]},{id:Math.uuid(undefined,16),name:new ContactName("Mark McArdle"),displayName:"Mark McArdle",emails:[new ContactField("work","mark@tinyhippos.com",false)]}],self;function _error(callback,code,msg){var e=new ContactError;e.code=code;e.message=msg;window.setTimeout(function(){callback(e)},1)}function _getContacts(){return db.retrieveObject("phonegap-contacts")||_defaultContacts.map(function(person){var contact=new Contact;contact.updated=new Date;utils.forEach(person,function(value,prop){contact[prop]=value});return contact})}function _saveContacts(contacts){db.saveObject("phonegap-contacts",contacts)}function _filtered(compare,options){var found=false;if(!options.filter||options.filter===""){found=true}else if(typeof compare==="string"&&compare.match(new RegExp(".*"+options.filter+".*","i"))){found=true}else if(typeof compare==="object"||compare instanceof Array){utils.forEach(compare,function(value){if(!found){found=_filtered(value,options)}})}return found}event.on("phonegap-contact-save",function(contactProperties,success){var contacts=_getContacts(),existsIndex=contacts.reduce(function(result,value,index){return value.id===contactProperties.id?index:result},-1),contact=existsIndex>=0?contacts[existsIndex]:new Contact;utils.mixin(contactProperties,contact);if(existsIndex<0){contacts.push(contact)}_saveContacts(contacts);success(contact)});event.on("phonegap-contact-remove",function(id,success,error){if(!id){_error(error,ContactError.NOT_FOUND_ERROR,"id is falsy ("+id+")")}else{var contacts=_getContacts(),toDelete=contacts.reduce(function(result,current,index){return current.id===id?index:result},-1);if(toDelete>=0){contacts.splice(toDelete,1);_saveContacts(contacts);success()}else{_error(error,ContactError.NOT_FOUND_ERROR,"could not find contact with id ("+id+")")}}});self=module.exports={create:function(properties){var contact=new Contact;utils.forEach(properties,function(value,key){contact[key]=value});return contact},find:function(fields,success,error,options){var foundContacts=[],tempContact=self.create(),contacts=_getContacts(),errorFlag=false;options=options||{};if(!fields||!("forEach"in fields)){errorFlag=true;_error(error,ContactError.INVALID_ARGUMENT_ERROR,"missing contact fields array");return}if(fields.length===1&&fields[0]==="*"){fields=utils.map(tempContact,function(v,k){return k})}fields.forEach(function(prop){if(!tempContact.hasOwnProperty(prop)){errorFlag=true;_error(error,ContactError.INVALID_ARGUMENT_ERROR,"invalid contact field ("+prop+")")}});if(typeof success!=="function"&&!errorFlag){errorFlag=true;_error(error,ContactError.INVALID_ARGUMENT_ERROR,"missing success callback")}if(errorFlag){return}if(fields.length>0){contacts.forEach(function(contact){var newContact=utils.copy(contact);if(options&&(!_filtered(contact,options)||options.updatedSince&&contact.updated&&contact.updated.getTime()<options.updatedSince.getTime())){return}utils.forEach(newContact,function(value,prop){if(typeof newContact[prop]!=="function"&&prop!=="id"&&!fields.some(function(field){return field===prop})){delete newContact[prop]}});foundContacts.push(newContact)})}window.setTimeout(function(){if(options.multiple===false){foundContacts=foundContacts.splice(0,1)}success(foundContacts)},1)}}});ripple.define("platform/cordova/1.0.0/device",function(ripple,exports,module){var _self={},event=ripple("event"),devices=ripple("devices");event.on("HardwareKey",function(key){event.trigger("HardwareKeyDefault",[key])});_self.__defineGetter__("name",function(){return devices.getCurrentDevice().name});_self.__defineGetter__("platform",function(){return devices.getCurrentDevice().osName});_self.__defineGetter__("uuid",function(){return devices.getCurrentDevice().uuid});_self.__defineGetter__("version",function(){return devices.getCurrentDevice().osVersion});_self.phonegap="placeholder string";module.exports=_self});ripple.define("platform/cordova/1.0.0/map",function(ripple,exports,module){module.exports={show:function(){throw"not implemented"}}});ripple.define("platform/cordova/1.0.0/navigator",function(ripple,exports,module){var nav=ripple("platform/w3c/1.0/navigator"),event=ripple("event"),_console=ripple("console"),utils=ripple("utils"),emulatorBridge=ripple("emulatorBridge"),_self={};event.on("TinyHipposLoaded",function(){var doc=emulatorBridge.document(),evt=doc.createEvent("Events");evt.initEvent("deviceready",true,true);doc.dispatchEvent(evt);_console.log("fired deviceready event!")});utils.mixin(nav,_self);module.exports=_self});ripple.define("platform/cordova/1.0.0/network",function(ripple,exports,module){var deviceSettings=ripple("deviceSettings"),_self={connection:{}};_self.connection.__defineGetter__("type",function(){return deviceSettings.retrieve("NetworkStatus.connectionType")});module.exports=_self});ripple.define("platform/cordova/1.0.0/notification",function(ripple,exports,module){var notifications=ripple("notifications"),_console=ripple("console"),goodVibrations=ripple("ui/plugins/goodVibrations");module.exports={alert:function(message){notifications.openNotification("normal",message)},beep:function(times){for(var i=times;i>0;i--){_console.log("beep!")}notifications.openNotification("normal","BEEP x "+times)},vibrate:function(milliseconds){milliseconds=milliseconds||500;goodVibrations.vibrateDevice(milliseconds)}}});ripple.define("platform/cordova/1.0.0/orientation",function(ripple,exports,module){module.exports={currentOrientation:null,getCurrentOrientation:function(){throw"not implemented"},watchOrientation:function(){throw"not implemented"}}});ripple.define("platform/cordova/1.0.0/service",function(ripple,exports,module){module.exports={}});ripple.define("platform/cordova/1.0.0/sms",function(ripple,exports,module){module.exports={send:function(){throw"not implemented"}}});ripple.define("platform/cordova/1.0.0/spec/config",function(ripple,exports,module){var constants=ripple("constants");module.exports={fileName:"config.xml",validateVersion:function(configValidationObject){var valid=true;valid=!(!configValidationObject.widget.validationResult[0].attributes.xmlns.valid||!configValidationObject.widget.validationResult[0].attributes["xmlns:gap"].valid);return valid},extractInfo:function(configValidationObject){if(!configValidationObject){return null}var widgetInfo={};widgetInfo.id=configValidationObject.widget.validationResult[0].attributes.id.value||"";widgetInfo.name=configValidationObject.widget.children.name.validationResult[0].value;widgetInfo.icon=configValidationObject.widget.children.icon.validationResult[0].attributes.src.value;widgetInfo.version=configValidationObject.widget.validationResult[0].attributes.version.value;return widgetInfo},schema:{rootElement:"widget",widget:{nodeName:"widget",required:true,occurrence:1,attributes:{xmlns:{attributeName:"xmlns",required:true,type:"list",listValues:["http://www.w3.org/ns/widgets"]},"xmlns:gap":{attributeName:"xmlns:gap",required:true,type:"list",listValues:["http://phonegap.com/ns/1.0"]},"xml:lang":{attributeName:"xml:lang",required:false,type:"iso-language"},dir:{attributeName:"dir",required:false,type:"list",listValues:["ltr","rtl","lro","rlo"]},id:{attributeName:"id",required:false,type:"string"},version:{attributeName:"version",required:false,type:"string"},height:{attributeName:"height",required:false,type:"integer"},width:{attributeName:"width",required:false,type:"integer"},viewmodes:{attributeName:"viewmodes",required:false,type:"list",listValues:["floating","fullscreen"]}},children:{name:{nodeName:"name",required:false,occurrence:0,type:"string",attributes:{"short":{attributeName:"short",type:"string",required:false},"xml:lang":{attributeName:"xml:lang",type:"string",required:false,unique:true}}},description:{nodeName:"description",required:false,occurrence:0,type:"string",attributes:{"xml:lang":{attributeName:"xml:lang",type:"string",required:false,unique:true}}},author:{nodeName:"author",required:false,occurrence:1,type:"string",attributes:{email:{attributeName:"email",type:"regex",required:false,regex:constants.REGEX.EMAIL},href:{attributeName:"href",type:"regex",required:false,regex:constants.REGEX.URL}}},license:{nodeName:"license",required:false,occurrence:1,type:"string",
attributes:{href:{attributeName:"href",type:"regex",required:false,regex:constants.REGEX.URL},"xml:lang":{attributeName:"xml:lang",type:"string",required:false,unique:true}}},icon:{nodeName:"icon",required:false,occurrence:0,attributes:{src:{attributeName:"src",type:"string",required:true},height:{attributeName:"height",required:false,type:"integer"},width:{attributeName:"width",required:false,type:"integer"}}},content:{nodeName:"content",required:false,occurrence:1,attributes:{src:{attributeName:"src",type:"string",required:true},encoding:{attributeName:"encoding",type:"string",required:false},type:{attributeName:"type",type:"string",required:false}}},feature:{nodeName:"feature",required:false,occurrence:0,attributes:{name:{attributeName:"name",type:"list",required:true,listValues:["http://api.phonegap.com/1.0/accelerometer","http://api.phonegap.com/1.0/camera","http://api.phonegap.com/1.0/compass","http://api.phonegap.com/1.0/contacts","http://api.phonegap.com/1.0/device","http://api.phonegap.com/1.0/events","http://api.phonegap.com/1.0/file","http://api.phonegap.com/1.0/geolocation","http://api.phonegap.com/1.0/media","http://api.phonegap.com/1.0/network","http://api.phonegap.com/1.0/notification","http://api.phonegap.com/1.0/storage"]},required:{attributeName:"required",type:"boolean",required:false}}},preference:{nodeName:"preference",required:false,occurrence:0,attributes:{name:{attributeName:"name",type:"string",required:true},value:{type:"string",attributeName:"value",required:false},readonly:{attributeName:"readonly",type:"boolean",required:false}}}}}}}});ripple.define("platform/cordova/1.0.0/spec/device",function(ripple,exports,module){module.exports={NetworkStatus:{connectionType:{name:"Connection Type",control:{type:"select",value:"ethernet"},options:{unknown:"UNKNOWN",ethernet:"ETHERNET",wifi:"WIFI","2g":"CELL_2G","3g":"CELL_3G","4g":"CELL_4G",none:"none"},callback:function(setting){var connected=setting!=="none";ripple("bus").send("network",connected)}},lag:{name:"Lag the network",control:{type:"checkbox",value:false},callback:function(setting){ripple("bus").send("lag",setting)}}}}});ripple.define("platform/cordova/1.0.0/spec/events",function(ripple,exports,module){function _fires(name){return function(){var doc=ripple("emulatorBridge").document(),evt=doc.createEvent("Events");evt.initEvent(name,true,false);doc.dispatchEvent(evt)}}module.exports={deviceready:{callback:_fires("deviceready")},backbutton:{callback:_fires("backbutton")},menubutton:{callback:_fires("menubutton")},pause:{callback:_fires("pause")},resume:{callback:_fires("resume")},searchbutton:{callback:_fires("searchbutton")},online:{callback:_fires("online")},offline:{callback:_fires("offline")}}});ripple.define("platform/cordova/1.0.0/spec/ui",function(ripple,exports,module){module.exports={plugins:["accelerometer","deviceSettings","geoView","widgetConfig","platformEvents"]}});ripple.define("platform/cordova/1.0.0/spec",function(ripple,exports,module){module.exports={id:"cordova",version:"1.0.0",name:"Apache Cordova / PhoneGap",type:"platform",persistencePrefix:"phonegap-",config:ripple("platform/cordova/1.0.0/spec/config"),device:ripple("platform/cordova/1.0.0/spec/device"),ui:ripple("platform/cordova/1.0.0/spec/ui"),events:ripple("platform/cordova/1.0.0/spec/events"),initialize:function(){},objects:{PhoneGap:{path:"cordova/1.0.0/PhoneGap"},Coordinates:{path:"w3c/1.0/Coordinates"},Position:{path:"w3c/1.0/Position"},PositionError:{path:"w3c/1.0/PositionError"},Acceleration:{path:"cordova/1.0.0/Acceleration"},navigator:{path:"cordova/1.0.0/navigator",children:{accelerometer:{path:"cordova/1.0.0/accelerometer"},geolocation:{path:"w3c/1.0/geolocation"},notification:{path:"cordova/1.0.0/notification"},contacts:{path:"cordova/1.0.0/contacts"},network:{path:"cordova/1.0.0/network"},camera:{path:"cordova/1.0.0/camera"},sms:{path:"cordova/1.0.0/sms"},telephony:{path:"cordova/1.0.0/telephony"},map:{path:"cordova/1.0.0/map"},orientation:{path:"cordova/1.0.0/orientation"},system:{path:"cordova/1.0.0/system"},compass:{path:"cordova/1.0.0/compass"}}},ContactError:{path:"cordova/1.0.0/ContactError"},Contact:{path:"cordova/1.0.0/Contact"},ContactName:{path:"cordova/1.0.0/ContactName"},ContactAccount:{path:"cordova/1.0.0/ContactAccount"},ContactAddress:{path:"cordova/1.0.0/ContactAddress"},ContactOrganization:{path:"cordova/1.0.0/ContactOrganization"},ContactFindOptions:{path:"cordova/1.0.0/ContactFindOptions"},ContactField:{path:"cordova/1.0.0/ContactField"},NetworkStatus:{path:"cordova/1.0.0/NetworkStatus"},device:{path:"cordova/1.0.0/device"},SystemInfoOptions:{path:"cordova/1.0.0/SystemInfoOptions"},PowerAttributes:{path:"cordova/1.0.0/PowerAttributes"},CPUAttributes:{path:"cordova/1.0.0/CPUAttributes"},ThermalAttributes:{path:"cordova/1.0.0/ThermalAttributes"},NetworkAttributes:{path:"cordova/1.0.0/NetworkAttributes"},Connection:{path:"cordova/1.0.0/Connection"},ConnectionAttributes:{path:"cordova/1.0.0/ConnectionAttributes"},SensorAttributes:{path:"cordova/1.0.0/SensorAttributes"},AVCodecsAttributes:{path:"cordova/1.0.0/AVCodecsAttributes"},AudioCodecAttributes:{path:"cordova/1.0.0/AudioCodecAttributes"},VideoCodecAttributes:{path:"cordova/1.0.0/VideoCodecAttributes"},StorageUnitAttributes:{path:"cordova/1.0.0/StorageUnitAttributes"},InputDevicesAttributes:{path:"cordova/1.0.0/InputDevicesAttributes"},OutputDevicesAttributes:{path:"cordova/1.0.0/OutputDevicesAttributes"},DisplayDeviceAttributes:{path:"cordova/1.0.0/DisplayDeviceAttributes"},AudioDeviceAttributes:{path:"cordova/1.0.0/AudioDeviceAttributes"},PrintingDeviceAttributes:{path:"cordova/1.0.0/PrintingDeviceAttributes"},BrailleDeviceAttributes:{path:"cordova/1.0.0/BrailleDeviceAttributes"},PointerAttributes:{path:"cordova/1.0.0/PointerAttributes"},KeyboardAttributes:{path:"cordova/1.0.0/KeyboardAttributes"},CameraAttributes:{path:"cordova/1.0.0/CameraAttributes"},MicrophoneAttributes:{path:"cordova/1.0.0/MicrophoneAttributes"}}}});ripple.define("platform/cordova/1.0.0/system",function(ripple,exports,module){module.exports={get:function(){throw"not implemented"},has:function(){throw"not implemented"},monitor:function(){throw"not implemented"}}});ripple.define("platform/cordova/1.0.0/telephony",function(ripple,exports,module){module.exports={send:function(){throw"not implemented"}}});ripple.define("platform/cordova/2.0.0/JavaPluginManager",function(ripple,exports,module){module.exports={exec:function(){throw"this really shouldn't be called. like ever!"},resume:function(){throw"this shouldn't be called"},pause:function(){throw"this shouldn't be called"},destroy:function(){throw"this shouldn't be called"}}});ripple.define("platform/cordova/2.0.0/MediaError",function(ripple,exports,module){var MediaError=function(code,msg){this.code=code!==undefined?code:null;this.message=msg||""};MediaError.MEDIA_ERR_NONE_ACTIVE=0;MediaError.MEDIA_ERR_ABORTED=1;MediaError.MEDIA_ERR_NETWORK=2;MediaError.MEDIA_ERR_DECODE=3;MediaError.MEDIA_ERR_NONE_SUPPORTED=4;module.exports=MediaError});ripple.define("platform/cordova/2.0.0/bridge/accelerometer",function(ripple,exports,module){var event=ripple("event"),_success,_error,_current={x:0,y:0,z:0,timestamp:(new Date).getTime()},_interval;event.on("AccelerometerInfoChangedEvent",function(accelerometerInfo){_current.x=accelerometerInfo.accelerationIncludingGravity.x;_current.y=accelerometerInfo.accelerationIncludingGravity.y;_current.z=accelerometerInfo.accelerationIncludingGravity.z;_current.timestamp=(new Date).getTime()});module.exports={start:function(success,error){_success=success;_error=error;_interval=window.setInterval(function(){_current.timestamp=(new Date).getTime();_success(_current)},50)},stop:function(){_success=null;_error=null;window.clearInterval(_interval)}}});ripple.define("platform/cordova/2.0.0/bridge/app",function(ripple,exports,module){var _console=ripple("console");module.exports={show:function(success){return success&&success()},exitApp:function(win,fail,args){_console.warn("Application must exit now.")},overrideBackbutton:function(win,fail,args){_console.log("Native back button handler was detached.")},messageChannel:function(){}}});ripple.define("platform/cordova/2.0.0/bridge/battery",function(ripple,exports,module){var constants=ripple("constants"),db=ripple("db");module.exports={start:function(win,fail,args){var batteryLevel=db.retrieve(constants.BATTERY_STATUS.BATTERY_STATUS_KEY)||100;var isPlugged=db.retrieve(constants.BATTERY_STATUS.IS_PLUGGED_KEY)||false;var info={level:batteryLevel,isPlugged:isPlugged};win(info)},stop:function(win,fail,args){}}});ripple.define("platform/cordova/2.0.0/bridge/camera",function(ripple,exports,module){var camera=ripple("ui/plugins/camera"),event=ripple("event");module.exports={takePicture:function(success){event.once("captured-image",function(uri){success(uri)});camera.show()},cleanup:function(success){success()}}});ripple.define("platform/cordova/2.0.0/bridge/capture",function(ripple,exports,module){var camera=ripple("ui/plugins/camera"),event=ripple("event");module.exports={captureImage:function(success,error){event.once("captured-image",function(uri,file){file.fullPath=uri;success([file])});event.once("image-capture-cancelled",function(){error({code:ripple("emulatorBridge").window().CaptureError.CAPTURE_NO_MEDIA_FILES})});camera.show()}}});ripple.define("platform/cordova/2.0.0/bridge/compass",function(ripple,exports,module){var geo=ripple("geo"),bridge=ripple("emulatorBridge"),_success,_error,_interval;module.exports={getHeading:function(success){var win=bridge.window(),heading=new win.CompassHeading;heading.trueHeading=geo.getPositionInfo().heading;heading.magneticHeading=geo.getPositionInfo().heading;heading.headingAccuracy=100;success(heading)},stopHeading:function(){},start:function(success,error){_success=success;_error=error;_interval=window.setInterval(function(){var win=bridge.window(),heading=new win.CompassHeading;heading.trueHeading=geo.getPositionInfo().heading;heading.magneticHeading=geo.getPositionInfo().heading;heading.headingAccuracy=100;success(heading)},50)},stop:function(){_success=null;_error=null;window.clearInterval(_interval)}}});ripple.define("platform/cordova/2.0.0/bridge/console",function(ripple,exports,module){module.exports={log:function(win,fail,args){console.log(args[0])},logLevel:function(win,fail,args){var message=args[1];switch(args[0]){case"ERROR":console.log("ERROR: "+message);break;case"WARN":console.log("WARN: "+message);break;case"INFO":console.log("INFO: "+message);break;case"DEBUG":console.log("DEBUG: "+message);break;default:console.log(message);break}}}});ripple.define("platform/cordova/2.0.0/bridge/contacts",function(ripple,exports,module){var db=ripple("db"),utils=ripple("utils"),emulatorBridge=ripple("emulatorBridge"),_self;function _default(){return[{name:{formatted:"Brent Lintner"},displayName:"Brent Lintner",emails:[{type:"work",value:"brent@tinyhippos.com",pref:false}]},{name:{formatted:"PJ Lowe"},displayName:"PJ Lowe",emails:[{type:"work",value:"pj@tinyhippos.com",pref:false}]},{name:{formatted:"Dan Silivestru"},displayName:"Dan Silivestru",emails:[{type:"work",value:"dan@tinyhippos.com",pref:false}]},{name:{formatted:"Gord Tanner"},displayName:"Gord Tanner",emails:[{type:"work",value:"gord@tinyhippos.com",pref:true}]},{name:{formatted:"Mark McArdle"},displayName:"Mark McArdle",emails:[{type:"work",value:"mark@tinyhippos.com",pref:false}]}].map(function(obj){obj.id=Math.uuid(undefined,16);return emulatorBridge.window().navigator.contacts.create(obj)})}function _get(){var contacts=db.retrieveObject("cordova-contacts");if(!contacts){contacts=_default();_save(contacts)}return contacts}function _save(contacts){db.saveObject("cordova-contacts",contacts)}function _filtered(compare,options){var found=false;if(!options.filter||options.filter===""){found=true}else if(typeof compare==="string"&&compare.match(new RegExp(".*"+options.filter+".*","i"))){found=true}else if(typeof compare==="object"||compare instanceof Array){utils.forEach(compare,function(value){if(!found){found=_filtered(value,options)}})}return found}_self={search:function(success,error,args){var fields=args[0],options=args[1],foundContacts=[],tempContact=emulatorBridge.window().navigator.contacts.create(),contacts=_get();options=options||{};if(fields.length===1&&fields[0]==="*"){fields=utils.map(tempContact,function(v,k){return k})}if(fields.length>0){contacts.forEach(function(contact){var newContact=emulatorBridge.window().navigator.contacts.create(contact);if(options&&!_filtered(contact,options)){return}utils.forEach(newContact,function(value,prop){if(typeof newContact[prop]!=="function"&&prop!=="id"&&!fields.some(function(field){return field===prop})){delete newContact[prop]}});foundContacts.push(newContact)})}if(options.multiple===false){foundContacts=foundContacts.splice(0,1)}success(foundContacts)},save:function(success,error,args){var contacts=_get(),contact=args[0],index;if(!contact.id){contact.id=Math.uuid(undefined,16);contacts.push(contact)}else{index=contacts.reduce(function(result,value,index){return value.id===contact.id?index:result},-1);if(index>=0){utils.mixin(contact,contacts[index]);var i=0;while(i<contact.emails.length){if(!contact.emails[i].value){contact.emails.splice(i,1)}else{i=i+1}}contact=contacts[index]}else{contact=null}}_save(contacts);if(success){success(contact)}},remove:function(success,error,args){var contacts=_get(),id=args[0],toDelete=contacts.reduce(function(result,current,index){return current.id===id?index:result},-1);if(toDelete>=0){contacts.splice(toDelete,1);_save(contacts);if(success){success()}}else{error(0)}}};module.exports=_self});ripple.define("platform/cordova/2.0.0/bridge/device",function(ripple,exports,module){var devices=ripple("devices");module.exports={getDeviceInfo:function(success){var device=devices.getCurrentDevice();success({available:true,platform:device.osName,version:device.osVersion,name:device.name,uuid:device.uuid,cordova:"2.0.0"})}}});ripple.define("platform/cordova/2.0.0/bridge/file",function(ripple,exports,module){var fs,topCordova=ripple("platform/cordova/2.0.0/spec"),rlfsu;function cleanPath(path){while(path[0]&&path[0]==="/"){path=path.substr(1)}return path}module.exports={requestFileSystem:function(win,fail,args){var rfs=window.webkitRequestFileSystem,type=args[0],size=args[1];if(size>1024*1024*1024){if(fail)fail(FileError.QUOTA_EXCEEDED_ERR)}else{return rfs(type,size,function(effes){fs=effes;win(effes)},fail)}},requestAllPaths:function(win,fail,args){var ret={};ret["applicationDirectory"]="file:///android_asset/";ret["applicationStorageDirectory"]="file://tmp/ripple/appstore";ret["dataDirectory"]="file://tmp/ripple/data";ret["cacheDirectory"]="file://tmp/";win(ret)},resolveLocalFileSystemURI:function(win,fail,args){var uri=args[0],fulluri=fs.root.toURL();if(uri.indexOf("file://localhost")===0){uri=uri.substr(16)}uri=cleanPath(uri);fulluri+=uri;return window.webkitResolveLocalFileSystemURL(fulluri,function(entry){if(win)win(entry)},function(error){if(fail)fail(error.code)})},getFile:function(win,fail,args){var path=args[0],filename=args[1],options=args[2],file="";path=cleanPath(path);filename=cleanPath(filename);if(path){file=path+"/"}file+=filename;fs.root.getFile(file,options,function(entry){if(win)win(entry)},function(err){if(fail)fail(err.code)})},remove:function(win,fail,args){var file=args[0];window.webkitResolveLocalFileSystemURL(fs.root.toURL()+file,function(entry){entry.remove(function(){if(win)win()},function(err){if(fail)fail(err.code)})},fail)},readEntries:function(win,fail,args){var root=fs.root.toURL(),path=args[0],reader;path=cleanPath(path);path=root+path;window.webkitResolveLocalFileSystemURL(path,function(entry){reader=entry.createReader();reader.readEntries(function(entries){if(win)win(entries)},function(err){if(fail)fail(err.code)})},function(err){if(fail)fail(err.code)})},getDirectory:function(win,fail,args){var path=args[0],filename=args[1],options=args[2],file="";path=cleanPath(path);filename=cleanPath(filename);if(path){file=path+"/"}file+=filename;fs.root.getDirectory(file,options,function(entry){if(win)win(entry)},function(err){if(fail)fail(err.code)})},removeRecursively:function(win,fail,args){var root=fs.root.toURL(),path=args[0];path=cleanPath(path);window.webkitResolveLocalFileSystemURL(root+path,function(dirEntry){dirEntry.removeRecursively(function(){if(win)win()},function(err){if(fail)fail(err.code)})},function(err){if(fail)fail(err.code)})},getFileMetadata:function(win,fail,args){var path=args[0],root=fs.root.toURL();path=cleanPath(path);window.webkitResolveLocalFileSystemURL(root+path,function(entry){entry.file(function(file){if(win){file.fullPath=path;win(file)}},function(err){if(fail)fail(err.code)})},function(err){if(fail)fail(err.code)})},getMetadata:function(win,fail,args){var path=args[0],root=fs.root.toURL();path=cleanPath(path);window.webkitResolveLocalFileSystemURL(root+path,function(entry){entry.getMetadata(function(data){if(win)win(data)},function(err){if(fail)fail(err.code)})},function(err){if(fail)fail(err.code)})},getParent:function(win,fail,args){var path=args[0],root=fs.root.toURL();path=cleanPath(path);window.webkitResolveLocalFileSystemURL(root+path,function(entry){entry.getParent(function(dirEntry){if(win)win(dirEntry)},function(err){if(fail)fail(err.code)})},function(err){if(fail)fail(err.code)})},copyTo:function(win,fail,args){var src=args[0],parent=args[1],name=args[2],root=fs.root.toURL();parent=cleanPath(parent);src=cleanPath(src);rlfsu=window.webkitResolveLocalFileSystemURL;rlfsu(root+parent,function(parentDirToCopyTo){rlfsu(root+src,function(sourceDir){sourceDir.copyTo(parentDirToCopyTo,name,function(newEntry){if(win)win(newEntry)},function(err){if(fail)fail(err.code)})},function(err){if(fail)fail(err.code)})},function(err){if(fail)fail(err.code)})},moveTo:function(win,fail,args){var src=args[0],parent=args[1],name=args[2],root=fs.root.toURL();parent=cleanPath(parent);src=cleanPath(src);rlfsu=window.webkitResolveLocalFileSystemURL;rlfsu(root+parent,function(parentDirToMoveTo){rlfsu(root+src,function(sourceDir){sourceDir.moveTo(parentDirToMoveTo,name,function(newEntry){if(win)win(newEntry)},function(err){if(fail)fail(err.code)})},function(err){if(fail)fail(err.code)})},function(err){if(fail)fail(err.code)})},write:function(win,fail,args){var file=args[0],text=args[1],position=args[2],sourcepath,blob;sourcepath=(file.fullPath?file.fullPath:"")+file.name;sourcepath=cleanPath(sourcepath);blob=new Blob([text],{type:"text/plain"});fs.root.getFile(sourcepath,{create:true},function(entry){entry.createWriter(function(writer){writer.onwriteend=function(progressEvt){if(win)win(progressEvt.total)};writer.onerror=function(err){if(fail)fail(err.code)};if(position&&position>0){writer.seek(position)}writer.write(blob)},function(err){if(fail)fail(err.code)})},function(err){if(fail)fail(err.code)})},readAsText:function(win,fail,args){var path=args[0],encoding=args[1],FileReader=topCordova.nativeMethods.FileReader,fr=new FileReader;fr.onerror=function(err){if(fail)fail(err.code)};fr.onload=function(evt){if(win)win(evt.target.result)};path=cleanPath(path);fs.root.getFile(path,{create:false},function(entry){entry.file(function(blob){fr.readAsText(blob,encoding)},function(err){if(fail)fail(err.code)})},function(err){if(fail)fail(err.code)})},readAsDataURL:function(win,fail,args){var path=args[0],FileReader=topCordova.nativeMethods.FileReader,fr=new FileReader;fr.onerror=function(err){if(fail)fail(err.code)};fr.onload=function(evt){if(win)win(evt.target.result)};path=cleanPath(path);fs.root.getFile(path,{create:false},function(entry){entry.file(function(blob){fr.readAsDataURL(blob)},function(err){if(fail)fail(err.code)})},function(err){if(fail)fail(err.code)})},truncate:function(win,fail,args){var file=args[0],position=args[1],sourcepath;sourcepath=cleanPath(file);fs.root.getFile(sourcepath,{create:false},function(entry){entry.createWriter(function(writer){writer.onwriteend=function(progressEvt){if(win)win(progressEvt.target.length)};writer.onerror=function(err){if(fail)fail(err.code)};writer.truncate(position)},function(err){if(fail)fail(err.code)})},function(err){if(fail)fail(err.code)})}}});ripple.define("platform/cordova/2.0.0/bridge/geolocation",function(ripple,exports,module){var event=ripple("event"),geo=ripple("geo"),utils=ripple("utils"),PositionError=ripple("platform/w3c/1.0/PositionError"),_watches={},_current={latitude:43.465187,longitude:-80.522372,altitude:100,accuracy:150,altitudeAccuracy:80,heading:0,velocity:0};function _getCurrentPosition(win,fail){if(geo.timeout){if(fail){var positionError=new PositionError;positionError.code=PositionError.TIMEOUT;positionError.message="position timed out";fail(positionError)}}else{win(geo.getPositionInfo())}}event.on("PositionInfoUpdatedEvent",function(pi){_current.latitude=pi.latitude;_current.longitude=pi.longitude;_current.altitude=pi.altitude;_current.accuracy=pi.accuracy;_current.altitudeAccuracy=pi.altitudeAccuracy;_current.heading=pi.heading;_current.velocity=pi.speed;utils.forEach(_watches,function(watch){try{_getCurrentPosition(watch.win,watch.fail)}catch(e){console.log(e)}})});module.exports={getLocation:function(success,error){_getCurrentPosition(success,error)},addWatch:function(success,error,args){_watches[args[0]]={win:success,fail:error};_getCurrentPosition(success,error)},clearWatch:function(success,error,args){delete _watches[args[0]];if(success&&typeof success==="function"){success()}},getPermission:function(success,error){if(success&&typeof success==="function"){success()}}}});ripple.define("platform/cordova/2.0.0/bridge/globalization",function(ripple,exports,module){var platform=ripple("platform"),deviceSettings=ripple("deviceSettings"),bridge=ripple("emulatorBridge"),GlobalizationError=bridge.window().GlobalizationError;function format(date,length,selector){if(selector==="time"){return moment(date).format("LT")}var result;switch(length){case"medium":result=moment(date).format("LL LT");break;case"long":result=moment(date).format("LLL");break;case"full":result=moment(date).format("LLLL");break;case"short":result=moment(date).format("L LT");break}if(selector==="date"){result=result.replace(" "+moment(date).format("LT"),"")}return result}function parse(str,length,selector){if(selector==="time"){return moment(str,moment.longDateFormat.LT)}var format;switch(length){case"medium":format=moment.longDateFormat.LL+" LT";break;case"long":format=moment.longDateFormat.LLL;break;case"full":format=moment.longDateFormat.LLLL;break;case"short":format=moment.longDateFormat.L+" LT";break}if(selector==="date"){format=format.replace(" LT","")}format=format.replace("LT",moment.longDateFormat.LT);return moment(str,format)}module.exports={getLocaleName:function(win){win({value:moment.lang()})},getPreferredLanguage:function(win){win({value:platform.current().device.globalization.locale.options[moment.lang()]})},dateToString:function(win,fail,args){var date=args[0].date,options=args[0].options||{},formatLength=options.formatLength,selector=options.selector;win({value:format(date,formatLength||"short",selector)})},stringToDate:function(win,fail,args){var str=args[0].dateString,options=args[0].options||{},result=parse(str,options.formatLength||"short",options.selector);if(result.isValid()){win({year:result.year(),month:result.month(),day:result.date(),hour:result.hours(),minute:result.minutes(),second:result.seconds(),millisecond:result.milliseconds()})}else{fail(new GlobalizationError(GlobalizationError.PARSING_ERROR,"Parsing Error"))}},getDatePattern:function(win,fail,args){var options=args[0].options||{},formatLength=options.formatLength||"short",selector=options.selector,pattern;if(selector==="time"){pattern=moment.longDateFormat.LT}else{switch(formatLength){case"medium":pattern=moment.longDateFormat.LL+" LT";break;case"long":pattern=moment.longDateFormat.LLL;break;case"full":pattern=moment.longDateFormat.LLLL;break;case"short":pattern=moment.longDateFormat.L+" LT";break}if(selector==="date"){pattern=pattern.replace(" LT","")}pattern=pattern.replace("LT",moment.longDateFormat.LT)}win({pattern:pattern,timezone:"???",utc_offset:0,dst_offset:0})},getDateNames:function(win,fail,args){var options=args[0].options||{},type=options.type||"wide",item=options.item||"months",key=item;if(key==="days")key="weekdays";if(type==="narrow")key+="Short";win({value:(new bridge.window).Array().concat(moment[key])})},isDayLightSavingsTime:function(win){win({dst:deviceSettings.retrieveAsBoolean("globalization.isDayLightSavingsTime")})},getFirstDayOfWeek:function(win){win({value:deviceSettings.retrieveAsInt("globalization.firstDayOfWeek")})},numberToString:function(win,fail,args){var number=args[0].number,options=args[0].options||{type:"decimal"},result={};switch(options.type){case"currency":result.value=accounting.formatMoney(number);break;case"percent":result.value=accounting.formatNumber(Math.round(number*100))+"%";break;case"decimal":result.value=accounting.formatNumber(number);break}win(result)},stringToNumber:function(win,fail,args){var number=args[0].numberString,options=args[0].options||{type:"decimal"},result={};result.value=accounting.unformat(number);if(options.type==="percent"){result.value=result.value/100}win(result)},getNumberPattern:function(win,fail,args){var pattern="#,##0",settings=accounting.settings.number;if(args[0].type==="currency"){settings=accounting.settings.currency;pattern=settings.symbol+pattern+".00"}else if(args[0].type==="percent"){settings={precision:0,decimal:accounting.settings.number.decimal,thousand:accounting.settings.number.thousand};pattern="#,##0%"}win({pattern:pattern,symbol:".",fraction:0,rounding:settings.precision,positive:"",negative:"-",decimal:settings.decimal,grouping:settings.thousand})},getCurrencyPattern:function(win,fail,args){var pattern=accounting.settings.currency.symbol+"#,##0.00";win({pattern:pattern,code:args[0].currencyCode,fraction:0,rounding:accounting.settings.currency.precision,decimal:accounting.settings.currency.decimal,grouping:accounting.settings.currency.thousand})}}});ripple.define("platform/cordova/2.0.0/bridge/logger",function(ripple,exports,module){module.exports={logLevel:function(success,fail,args){console.log(args.join(":"));return true}}});ripple.define("platform/cordova/2.0.0/bridge/media",function(ripple,exports,module){var audioObjects={},noop=function(){},messageChannel=null;function createAudio(id,src,error){var a=new Audio;a.addEventListener("error",function(e){error(new window.MediaError(1,e.toString()))});a.addEventListener("durationchange",function(){if(messageChannel){messageChannel({action:"status",status:{id:id,msgType:2,value:this.duration}})}else{cordova.require("cordova/plugin/Media").onStatus(id,2,this.duration)}});a.src=src;return a}module.exports={create:function(success,error,args){if(!args.length){error("Media Object id was not sent in arguments");return}var id=args[0],src=args[1];error=error||noop;success=success||noop;audioObjects[id]=createAudio(id,src,error);success()},startPlayingAudio:function(success,error,args){error=error||noop;success=success||noop;if(!args.length){error("Media Object id was not sent in arguments");return}var id=args[0],audio=audioObjects[id];if(args.length===1){error("Media source argument not found");return}if(audio){audio.pause();audioObjects[id]=undefined}audio=audioObjects[id]=createAudio(id,args[1],error);audio.play();success()},stopPlayingAudio:function(success,error,args){error=error||noop;success=success||noop;if(!args.length){error("Media Object id was not sent in arguments");return}var id=args[0],audio=audioObjects[id];if(!audio){error("Audio Object has not been initialized");return}audio.pause();audioObjects[id]=undefined;success()},seekToAudio:function(success,error,args){error=error||noop;success=success||noop;if(!args.length){error("Media Object id was not sent in arguments");return}var id=args[0],audio=audioObjects[id];if(!audio){error("Audio Object has not been initialized");return}else if(args.length===1){error("Media seek time argument not found");return}else{try{audio.currentTime=args[1]}catch(e){error("Error seeking audio: "+e)}}success()},pausePlayingAudio:function(success,error,args){error=error||noop;success=success||noop;if(!args.length){error("Media Object id was not sent in arguments");return}var id=args[0],audio=audioObjects[id];if(!audio){error("Audio Object has not been initialized");return}audio.pause();success()},getCurrentPositionAudio:function(success,error,args){error=error||noop;success=success||noop;if(!args.length){error("Media Object id was not sent in arguments");return}var id=args[0],audio=audioObjects[id];if(!audio){error("Audio Object has not been initialized");return}success(audio.currentTime)},getDuration:function(success,error,args){error=error||noop;success=success||noop;if(!args.length){error("Media Object id was not sent in arguments");return}var id=args[0],audio=audioObjects[id];if(!audio){error("Audio Object has not been initialized");return}success(audio.duration)},startRecordingAudio:function(success,error){error=error||noop;error("Not supported")},stopRecordingAudio:function(success,error){error=error||noop;error("Not supported")},release:function(success,error,args){error=error||noop;success=success||noop;if(!args.length){error("Media Object id was not sent in arguments");return}var id=args[0],audio=audioObjects[id];if(audio){audioObjects[id]=undefined;audio.src=undefined}success()},messageChannel:function(success){messageChannel=success}}});ripple.define("platform/cordova/2.0.0/bridge/network",function(ripple,exports,module){var deviceSettings=ripple("deviceSettings"),event=ripple("event"),_success;event.on("ConnectionChanged",function(){return _success&&_success(deviceSettings.retrieve("NetworkStatus.connectionType"))});module.exports={getConnectionInfo:function(success){_success=success;success(deviceSettings.retrieve("NetworkStatus.connectionType"))}}});ripple.define("platform/cordova/2.0.0/bridge/notification",function(ripple,exports,module){var notifications=ripple("notifications"),_console=ripple("console"),goodVibrations=ripple("ui/plugins/goodVibrations");module.exports={alert:function(success,error,args){notifications.openNotification("normal",args[0]);return success&&success()},confirm:function(resultCallback,someObject,confirmStrings){var options=confirmStrings;var message=options[0]||"";var title=options[1]||"";var buttonLabels=options[2];if(Object.prototype.toString.call(buttonLabels)==="[object Array]"){buttonLabels=buttonLabels.join(",")}notifications.confirmNotification(message,resultCallback,title,buttonLabels)},activityStart:function(){},activityStop:function(){},progressStart:function(){},vibrate:function(success,error,args){var ms=args[0]||500;goodVibrations.vibrateDevice(ms)},beep:function(success,error,args){for(var i=args[0];i>0;i--){_console.log("beep!")}notifications.openNotification("normal","BEEP x "+args[0])}}});ripple.define("platform/cordova/2.0.0/bridge",function(ripple,exports,module){var _prompt=ripple("ui/plugins/exec-dialog"),emulator={App:ripple("platform/cordova/2.0.0/bridge/app"),Accelerometer:ripple("platform/cordova/2.0.0/bridge/accelerometer"),Battery:ripple("platform/cordova/2.0.0/bridge/battery"),Compass:ripple("platform/cordova/2.0.0/bridge/compass"),Camera:ripple("platform/cordova/2.0.0/bridge/camera"),Capture:ripple("platform/cordova/2.0.0/bridge/capture"),Console:ripple("platform/cordova/2.0.0/bridge/console"),Contacts:ripple("platform/cordova/2.0.0/bridge/contacts"),"Debug Console":ripple("platform/cordova/2.0.0/bridge/console"),Device:ripple("platform/cordova/2.0.0/bridge/device"),File:ripple("platform/cordova/2.0.0/bridge/file"),Geolocation:ripple("platform/cordova/2.0.0/bridge/geolocation"),Globalization:ripple("platform/cordova/2.0.0/bridge/globalization"),Logger:ripple("platform/cordova/2.0.0/bridge/logger"),Media:ripple("platform/cordova/2.0.0/bridge/media"),"Network Status":ripple("platform/cordova/2.0.0/bridge/network"),
NetworkStatus:ripple("platform/cordova/2.0.0/bridge/network"),Notification:ripple("platform/cordova/2.0.0/bridge/notification")};module.exports={add:function(service,module){emulator[service]=module},exec:function(success,fail,service,action,args){try{emulator[service][action](success,fail,args)}catch(e){console.log("missing exec:"+service+"."+action);if(success||fail){_prompt.show(service,action,success,fail)}}}}});ripple.define("platform/cordova/2.0.0/logger",function(ripple,exports,module){module.exports={log:function(msg){console.log(msg)}}});ripple.define("platform/cordova/2.0.0/spec/config",function(ripple,exports,module){var constants=ripple("constants");module.exports={fileName:"config.xml",validateVersion:function(configValidationObject){var valid=true;valid=!(!configValidationObject.widget.validationResult[0].attributes.xmlns.valid||!configValidationObject.widget.validationResult[0].attributes["xmlns:gap"].valid);return valid},extractInfo:function(configValidationObject){if(!configValidationObject){return null}var widgetInfo={};widgetInfo.id=configValidationObject.widget.validationResult[0].attributes.id.value||"";widgetInfo.name=configValidationObject.widget.children.name.validationResult[0].value;widgetInfo.icon=configValidationObject.widget.children.icon.validationResult[0].attributes.src.value;widgetInfo.version=configValidationObject.widget.validationResult[0].attributes.version.value;return widgetInfo},schema:{rootElement:"widget",widget:{nodeName:"widget",required:true,occurrence:1,attributes:{xmlns:{attributeName:"xmlns",required:true,type:"list",listValues:["http://www.w3.org/ns/widgets"]},"xmlns:gap":{attributeName:"xmlns:gap",required:true,type:"list",listValues:["http://phonegap.com/ns/1.0"]},"xml:lang":{attributeName:"xml:lang",required:false,type:"iso-language"},dir:{attributeName:"dir",required:false,type:"list",listValues:["ltr","rtl","lro","rlo"]},id:{attributeName:"id",required:false,type:"string"},version:{attributeName:"version",required:false,type:"string"},height:{attributeName:"height",required:false,type:"integer"},width:{attributeName:"width",required:false,type:"integer"},viewmodes:{attributeName:"viewmodes",required:false,type:"list",listValues:["floating","fullscreen"]}},children:{name:{nodeName:"name",required:false,occurrence:0,type:"string",attributes:{"short":{attributeName:"short",type:"string",required:false},"xml:lang":{attributeName:"xml:lang",type:"string",required:false,unique:true}}},description:{nodeName:"description",required:false,occurrence:0,type:"string",attributes:{"xml:lang":{attributeName:"xml:lang",type:"string",required:false,unique:true}}},author:{nodeName:"author",required:false,occurrence:1,type:"string",attributes:{email:{attributeName:"email",type:"regex",required:false,regex:constants.REGEX.EMAIL},href:{attributeName:"href",type:"regex",required:false,regex:constants.REGEX.URL}}},license:{nodeName:"license",required:false,occurrence:1,type:"string",attributes:{href:{attributeName:"href",type:"regex",required:false,regex:constants.REGEX.URL},"xml:lang":{attributeName:"xml:lang",type:"string",required:false,unique:true}}},icon:{nodeName:"icon",required:false,occurrence:0,attributes:{src:{attributeName:"src",type:"string",required:true},height:{attributeName:"height",required:false,type:"integer"},width:{attributeName:"width",required:false,type:"integer"}}},content:{nodeName:"content",required:false,occurrence:1,attributes:{src:{attributeName:"src",type:"string",required:true},encoding:{attributeName:"encoding",type:"string",required:false},type:{attributeName:"type",type:"string",required:false}}},feature:{nodeName:"feature",required:false,occurrence:0,attributes:{name:{attributeName:"name",type:"list",required:true,listValues:["http://api.phonegap.com/1.0/accelerometer","http://api.phonegap.com/1.0/camera","http://api.phonegap.com/1.0/compass","http://api.phonegap.com/1.0/contacts","http://api.phonegap.com/1.0/device","http://api.phonegap.com/1.0/events","http://api.phonegap.com/1.0/file","http://api.phonegap.com/1.0/geolocation","http://api.phonegap.com/1.0/media","http://api.phonegap.com/1.0/network","http://api.phonegap.com/1.0/notification","http://api.phonegap.com/1.0/storage"]},required:{attributeName:"required",type:"boolean",required:false}}},preference:{nodeName:"preference",required:false,occurrence:0,attributes:{name:{attributeName:"name",type:"string",required:true},value:{type:"string",attributeName:"value",required:false},readonly:{attributeName:"readonly",type:"boolean",required:false}}}}}}}});ripple.define("platform/cordova/2.0.0/spec/device",function(ripple,exports,module){module.exports={NetworkStatus:{connectionType:{name:"Connection Type",control:{type:"select",value:"ethernet"},options:{unknown:"UNKNOWN",ethernet:"ETHERNET",wifi:"WIFI","2g":"CELL_2G","3g":"CELL_3G","4g":"CELL_4G",none:"none"},callback:function(setting){var win=ripple("emulatorBridge").window(),_console=ripple("console"),connected=setting!=="none",eventName=connected?"online":"offline";if(win&&win.cordova){win.cordova.fireDocumentEvent(eventName);_console.log("fired event ==> "+eventName)}ripple("bus").send("network",connected)}},lag:{name:"Lag the network",control:{type:"checkbox",value:false},callback:function(setting){ripple("bus").send("lag",setting)}}},globalization:{locale:{name:"locale name",control:{type:"select",value:"en"},options:{en:"English","en-ca":"English (Canadian)",fr:"French","fr-ca":"French (Canadian)",de:"German",ru:"Русский"},callback:function(setting){moment.lang(setting)}},isDayLightSavingsTime:{name:"Is daylight saving time",control:{type:"checkbox",value:false}},firstDayOfWeek:{name:"First Day of the week",control:{type:"select",value:"1"},options:{1:"Sunday",2:"Monday",3:"Tuesday",4:"Wednesday",5:"Thursday",6:"Friday",7:"Saturday"}}}}});ripple.define("platform/cordova/2.0.0/spec/events",function(ripple,exports,module){function _fires(name,data){return function(){var win=ripple("emulatorBridge").window();if(win&&win.cordova){win.cordova.fireDocumentEvent(name,data)}}}module.exports={deviceready:{callback:_fires("deviceready")},backbutton:{callback:_fires("backbutton")},menubutton:{callback:_fires("menubutton")},pause:{callback:_fires("pause")},resume:{callback:_fires("resume")},searchbutton:{callback:_fires("searchbutton")},online:{callback:_fires("online")},offline:{callback:_fires("offline")}}});ripple.define("platform/cordova/2.0.0/spec/ui",function(ripple,exports,module){module.exports={plugins:["accelerometer","deviceSettings","geoView","batteryStatus","widgetConfig","platformEvents"]}});ripple.define("platform/cordova/2.0.0/spec",function(ripple,exports,module){function loadWebworks(win,device){var builder=ripple("platform/builder"),platform="handset",webworks;switch(device.id){case"Playbook":platform="tablet/2.0.0";break;case"Z10":case"Q10":platform="bb10/1.0.0";break;default:platform="handset/2.0.0";break}webworks=ripple("platform/webworks."+platform+"/spec");builder.build(webworks.objects).into(win);builder.build(webworks.objects).into(window)}module.exports={id:"cordova",version:"2.0.0",name:"Apache Cordova",type:"platform",nativeMethods:{},config:ripple("platform/cordova/2.0.0/spec/config"),device:ripple("platform/cordova/2.0.0/spec/device"),ui:ripple("platform/cordova/2.0.0/spec/ui"),events:ripple("platform/cordova/2.0.0/spec/events"),initialize:function(win){var honeypot=ripple("honeypot"),devices=ripple("devices"),device=devices.getCurrentDevice(),bridge=ripple("platform/cordova/2.0.0/bridge"),cordova,topCordova=window.top.ripple("platform/cordova/2.0.0/spec"),get=function(){return cordova},set=function(orig){if(cordova){return}cordova=orig;cordova.define.remove("cordova/exec");cordova.define("cordova/exec",function(require,exports,module){module.exports=bridge.exec});cordova.UsePolling=true;cordova.define.remove("cordova/plugin/android/polling");cordova.define("cordova/plugin/android/polling",function(require,exports,module){module.exports=function(){}});var builder=cordova.require("cordova/builder"),allTheThings=win,base,iosPlugin;try{base=cordova.require("cordova/common");if(builder.build){builder.build(base.objects).intoAndClobber(allTheThings)}else{builder.buildIntoAndClobber(base.objects,allTheThings)}}catch(e){}cordova.require("cordova/channel").onNativeReady.fire();try{iosPlugin=cordova.require("cordova/plugin/ios/device");bridge.exec(function(info){iosPlugin.setInfo(info)},null,"Device","getDeviceInfo",[])}catch(e){cordova.require("cordova/channel").onCordovaInfoReady.fire()}};if(window.FileReader&&!topCordova.nativeMethods.FileReader){topCordova.nativeMethods.FileReader=window.FileReader}if(device.manufacturer==="BlackBerry"){loadWebworks(win,device)}honeypot.monitor(win,"cordova").andRun(get,set)},objects:{MediaError:{path:"cordova/2.0.0/MediaError"},Acceleration:{path:"w3c/1.0/Acceleration"},Coordinates:{path:"w3c/1.0/Coordinates"},Position:{path:"w3c/1.0/Position"},PositionError:{path:"w3c/1.0/PositionError"},navigator:{path:"w3c/1.0/navigator",children:{geolocation:{path:"w3c/1.0/geolocation"}}},org:{children:{apache:{children:{cordova:{children:{Logger:{path:"cordova/2.0.0/logger"},JavaPluginManager:{path:"cordova/2.0.0/JavaPluginManager"}}}}}}}}}});ripple.define("platform/cordova/3.0.0/bridge/PluginManager",function(ripple,exports,module){module.exports={startup:function(success){return success&&success()}}});ripple.define("platform/cordova/3.0.0/bridge/barcodescanner",function(ripple,exports,module){var ui=ripple("ui"),serviceUrl="https://chart.googleapis.com/chart?cht=qr&chs=300x300&chld=L|5&chl=";function _processScanOk(success){var scannedResult={cancelled:false,text:$("#scannedText").val(),format:$("#formatDropDown option:selected").text()};success(scannedResult)}function _processScanCancel(success){var scannedResult={cancelled:true,text:"",format:""};success(scannedResult)}module.exports={scan:function(success,error,args){try{$("#scanDialog").dialog({autoOpen:true,modal:true,title:"Barcode Scanner",heigh:50,width:510,position:"center",resizable:false,buttons:[{text:"OK",click:function(){$(this).dialog("close");_processScanOk(success)},"class":"ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only small-button"},{text:"Cancel",click:function(){$(this).dialog("close");_processScanCancel(success)},"class":"ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only small-button"}]})}catch(err){error("Fail to emulate BarcodeScanner.scan() method")}},encode:function(success,error,args){var data=args[0].data,url=serviceUrl+data;try{document.getElementById("barcodeClose").addEventListener("click",function(){ui.hideOverlay("barcodeBackground")});$("#barcodeImage").attr("src",url);$("#barcodeData").html(data);ui.showOverlay("barcodeBackground");success()}catch(err){error("Fail to emulate BarcodeScanner.encode() method")}}}});ripple.define("platform/cordova/3.0.0/bridge/coreandroid",function(ripple,exports,module){var _console=ripple("console");module.exports={show:function(success){return success&&success()},exitApp:function(win,fail,args){_console.warn("Application must exit now.")},overrideBackbutton:function(win,fail,args){_console.log("Native back button handler was detached.")},messageChannel:function(){}}});ripple.define("platform/cordova/3.0.0/bridge/inappbrowser",function(ripple,exports,module){var event=ripple("event"),ui=ripple("ui"),browser=ripple("ui/plugins/browser");module.exports={open:function(win,fail,args){var url=args[0],target=args[1],options=args[2],trigger=function(event){return function(){return win&&win({type:event,url:url})}};browser.show(url,target,options);jWorkflow.order().chill(1).andThen(trigger("loadstart")).chill(10).andThen(trigger("loadstop")).start();event.once("browser-close",trigger("exit"))},show:function(){ui.showOverlay("inappbrowser")},close:function(){browser.hide()},injectScriptCode:function(win,fail,args){browser.injectScript(args[0])},injectScriptFile:function(win,fail,args){browser.injectScript(args[0])},injectStyleCode:function(win,fail,args){browser.injectCSS(args[0])},injectStyleFile:function(win,fail,args){browser.injectCSS(args[0])}}});ripple.define("platform/cordova/3.0.0/bridge/insomnia",function(ripple,exports,module){module.exports={keepAwake:function(win,fail,args){if(!$.isArray(args))throw new Error("Arguments must be an array");if(args.length>0)throw new Error("No Arguments beside the callbacks allowed");console.warn("insomnia.keepAwake() has been called!")},allowSleepAgain:function(win,fail,args){if(!$.isArray(args))throw new Error("Arguments must be an array");if(args.length>0)throw new Error("No Arguments beside the callbacks allowed");console.warn("insomnia.allowSleepAgain() has been called!")}}});ripple.define("platform/cordova/3.0.0/bridge/keyboard",function(ripple,exports,module){module.exports={init:function(win,fail,args){win("H")}}});ripple.define("platform/cordova/3.0.0/bridge/nfcdummy",function(ripple,exports,module){module.exports={init:function(win,fail,args){fail("nfc is not supported on ripple")}}});ripple.define("platform/cordova/3.0.0/bridge/scanditsdk",function(ripple,exports,module){var db=ripple("db"),dialogTmpl='<div><input type="text" class="ui-state-default ui-corner-all" placeholder="Barcode or blank for error call"/></div>';module.exports={scan:function(win,fail,args){if(!$.isArray(args))throw new Error("Arguments must be an array");if(!args.length||typeof args[0]!="string")throw new Error("Application key is required");if($("#dialog-requestbarcode").length>0)return;var barcode=db.retrieve("lastBarcode","scanditsdk"),barcodeType,dialogContainer=$(dialogTmpl).attr({id:"dialog-requestbarcode",title:"Enter barcode data"});if(barcode){dialogContainer.find("input").val(barcode)}dialogContainer.dialog({appendTo:"body",modal:true,resizable:false,autoOpen:true,position:"center",minWidth:"400",buttons:[{text:"Cancel",click:function(){dialogContainer.dialog("close");dialogContainer.remove();fail()}},{text:"Ok",click:function(){barcode=$.trim(dialogContainer.find("input").val());dialogContainer.dialog("close");dialogContainer.remove();if(barcode){db.save("lastBarcode",barcode,"scanditsdk");win([barcode,barcodeType])}else{fail()}}}]})}};["start","stop","cancel","pause","resume","resize","torch"].forEach(function(name){module.exports[name]=function(){var messages=["No emulation method found for ScanditSDK call [",name,"] called with:"];messages.push(arguments);console.warn.apply(console,messages)}})});ripple.define("platform/cordova/3.0.0/bridge/splashscreen",function(ripple,exports,module){var ui=ripple("ui");module.exports={show:function(){ui.showOverlay("splashscreen")},hide:function(){ui.hideOverlay("splashscreen")}}});ripple.define("platform/cordova/3.0.0/bridge/statusbar",function(ripple,exports,module){module.exports={_ready:function(win,fail,args){win(false)}}});ripple.define("platform/cordova/3.0.0/bridge/vibration",function(ripple,exports,module){var goodVibrations=ripple("ui/plugins/goodVibrations");var event=ripple("event");var timerId=null;var pattern=[];var repeat=-1;function cancelVibrationPattern(){goodVibrations.stop();if(timerId)clearTimeout(timerId);timerId=null;pattern=[];repeat=-1}function patternIsFinished(i){if(i>=pattern.length){if(repeat>0){repeat=repeat-1;runNextPatternStep(0)}return true}return false}function runNextPatternStep(i){var ms;if(patternIsFinished(i)){return}ms=pattern[i];if(ms>0)goodVibrations.vibrateDevice(ms);i=i+2;if(patternIsFinished(i)){return}timerId=setTimeout(function(){runNextPatternStep(i)},pattern[i-1]+pattern[i-2])}module.exports={vibrateWithPattern:function(win,fail,args){if(pattern.length>0){cancelVibrationPattern()}pattern=args[0];repeat=args[1];runNextPatternStep(0)},cancelVibration:function(win,fail,args){cancelVibrationPattern()},vibrate:function(win,fail,args){var ms=args[0]||500;cancelVibrationPattern();goodVibrations.vibrateDevice(ms)}};event.on("EmulatorUnload",cancelVibrationPattern)});ripple.define("platform/cordova/3.0.0/spec/config",function(ripple,exports,module){var constants=ripple("constants");module.exports={fileName:"config.xml",validateVersion:function(configValidationObject){var valid=true;valid=!(!configValidationObject.widget.validationResult[0].attributes.xmlns.valid||!configValidationObject.widget.validationResult[0].attributes["xmlns:gap"].valid);return valid},extractInfo:function(configValidationObject){if(!configValidationObject){return null}var widgetInfo={};widgetInfo.id=configValidationObject.widget.validationResult[0].attributes.id.value||"";widgetInfo.name=configValidationObject.widget.children.name.validationResult[0].value;widgetInfo.icon=configValidationObject.widget.children.icon.validationResult[0].attributes.src.value;widgetInfo.version=configValidationObject.widget.validationResult[0].attributes.version.value;widgetInfo.whitelist=configValidationObject.widget.children.access.validationResult.map(function(r){return{origin:r.attributes.origin.value,subdomains:r.attributes.subdomains.value}});return widgetInfo},schema:{rootElement:"widget",widget:{nodeName:"widget",required:true,occurrence:1,attributes:{xmlns:{attributeName:"xmlns",required:true,type:"list",listValues:["http://www.w3.org/ns/widgets"]},"xmlns:gap":{attributeName:"xmlns:gap",required:true,type:"list",listValues:["http://phonegap.com/ns/1.0"]},"xml:lang":{attributeName:"xml:lang",required:false,type:"iso-language"},dir:{attributeName:"dir",required:false,type:"list",listValues:["ltr","rtl","lro","rlo"]},id:{attributeName:"id",required:false,type:"string"},version:{attributeName:"version",required:false,type:"string"},height:{attributeName:"height",required:false,type:"integer"},width:{attributeName:"width",required:false,type:"integer"},viewmodes:{attributeName:"viewmodes",required:false,type:"list",listValues:["floating","fullscreen"]}},children:{name:{nodeName:"name",required:false,occurrence:0,type:"string",attributes:{"short":{attributeName:"short",type:"string",required:false},"xml:lang":{attributeName:"xml:lang",type:"string",required:false,unique:true}}},description:{nodeName:"description",required:false,occurrence:0,type:"string",attributes:{"xml:lang":{attributeName:"xml:lang",type:"string",required:false,unique:true}}},author:{nodeName:"author",required:false,occurrence:1,type:"string",attributes:{email:{attributeName:"email",type:"regex",required:false,regex:constants.REGEX.EMAIL},href:{attributeName:"href",type:"regex",required:false,regex:constants.REGEX.URL}}},license:{nodeName:"license",required:false,occurrence:1,type:"string",attributes:{href:{attributeName:"href",type:"regex",required:false,regex:constants.REGEX.URL},"xml:lang":{attributeName:"xml:lang",type:"string",required:false,unique:true}}},icon:{nodeName:"icon",required:false,occurrence:0,attributes:{src:{attributeName:"src",type:"string",required:true},height:{attributeName:"height",required:false,type:"integer"},width:{attributeName:"width",required:false,type:"integer"}}},content:{nodeName:"content",required:false,occurrence:1,attributes:{src:{attributeName:"src",type:"string",required:true},encoding:{attributeName:"encoding",type:"string",required:false},type:{attributeName:"type",type:"string",required:false}}},access:{nodeName:"access",required:false,occurrence:0,attributes:{origin:{attributeName:"origin",type:"string",required:true},subdomains:{attributeName:"subdomains",type:"boolean",required:false}}},feature:{nodeName:"feature",required:false,occurrence:0,attributes:{name:{attributeName:"name",type:"list",required:true,listValues:["http://api.phonegap.com/1.0/accelerometer","http://api.phonegap.com/1.0/camera","http://api.phonegap.com/1.0/compass","http://api.phonegap.com/1.0/contacts","http://api.phonegap.com/1.0/device","http://api.phonegap.com/1.0/events","http://api.phonegap.com/1.0/file","http://api.phonegap.com/1.0/geolocation","http://api.phonegap.com/1.0/media","http://api.phonegap.com/1.0/network","http://api.phonegap.com/1.0/notification","http://api.phonegap.com/1.0/storage"]},required:{attributeName:"required",type:"boolean",required:false}}},preference:{nodeName:"preference",required:false,occurrence:0,attributes:{name:{attributeName:"name",type:"string",required:true},value:{type:"string",attributeName:"value",required:false},readonly:{attributeName:"readonly",type:"boolean",required:false}}}}}}}});ripple.define("platform/cordova/3.0.0/spec",function(ripple,exports,module){module.exports={id:"cordova",version:"3.0.0",name:"Apache Cordova",type:"platform",nativeMethods:{},config:ripple("platform/cordova/3.0.0/spec/config"),device:ripple("platform/cordova/2.0.0/spec/device"),ui:ripple("platform/cordova/2.0.0/spec/ui"),events:ripple("platform/cordova/2.0.0/spec/events"),initialize:function(win){var honeypot=ripple("honeypot"),devices=ripple("devices"),device=devices.getCurrentDevice(),bridge=ripple("platform/cordova/2.0.0/bridge"),cordova,get=function(){return cordova},set=function(orig){if(cordova)return;cordova=orig;cordova.define.remove("cordova/exec");cordova.define("cordova/exec",function(require,exports,module){module.exports=bridge.exec;module.exports.init=function(){cordova.require("cordova/channel").onNativeReady.fire()}})};bridge.add("PluginManager",ripple("platform/cordova/3.0.0/bridge/PluginManager"));bridge.add("SplashScreen",ripple("platform/cordova/3.0.0/bridge/splashscreen"));bridge.add("InAppBrowser",ripple("platform/cordova/3.0.0/bridge/inappbrowser"));bridge.add("Vibration",ripple("platform/cordova/3.0.0/bridge/vibration"));bridge.add("CoreAndroid",ripple("platform/cordova/3.0.0/bridge/coreandroid"));bridge.add("ScanditSDK",ripple("platform/cordova/3.0.0/bridge/scanditsdk"));bridge.add("Insomnia",ripple("platform/cordova/3.0.0/bridge/insomnia"));bridge.add("BarcodeScanner",ripple("platform/cordova/3.0.0/bridge/barcodescanner"));bridge.add("NfcPlugin",ripple("platform/cordova/3.0.0/bridge/nfcdummy"));bridge.add("Keyboard",ripple("platform/cordova/3.0.0/bridge/keyboard"));bridge.add("StatusBar",ripple("platform/cordova/3.0.0/bridge/statusbar"));honeypot.monitor(win,"cordova").andRun(get,set);if(device.manufacturer==="BlackBerry"){navigator.vibrate=function(ms){ripple("platform/cordova/3.0.0/bridge/vibration").vibrate(null,null,[ms])}}},objects:{MediaError:{path:"cordova/2.0.0/MediaError"},Acceleration:{path:"w3c/1.0/Acceleration"},Coordinates:{path:"w3c/1.0/Coordinates"},Position:{path:"w3c/1.0/Position"},PositionError:{path:"w3c/1.0/PositionError"},navigator:{path:"w3c/1.0/navigator",children:{geolocation:{path:"w3c/1.0/geolocation"}}},org:{children:{apache:{children:{cordova:{children:{Logger:{path:"cordova/2.0.0/logger"},JavaPluginManager:{path:"cordova/2.0.0/JavaPluginManager"}}}}}}}}}});ripple.define("platform/spec",function(ripple,exports,module){module.exports={cordova:{"1.0.0":ripple("platform/cordova/1.0.0/spec"),"2.0.0":ripple("platform/cordova/2.0.0/spec"),"3.0.0":ripple("platform/cordova/3.0.0/spec")},"webworks.bb10":{"1.0.0":ripple("platform/webworks.bb10/1.0.0/spec")},"webworks.handset":{"2.0.0":ripple("platform/webworks.handset/2.0.0/spec")},"webworks.tablet":{"2.0.0":ripple("platform/webworks.tablet/2.0.0/spec")},web:{"default":ripple("platform/web/default/spec")},get:function(name,version){var platform=module.exports[name]||{};return platform[version]||platform[Object.keys(platform)[0]]}}});ripple.define("platform/w3c/1.0/Acceleration",function(ripple,exports,module){module.exports=function(x,y,z){return{x:x||0,y:y||0,z:z||0}}});ripple.define("platform/w3c/1.0/Coordinates",function(ripple,exports,module){module.exports=function(latitude,longitude,altitude,accuracy,altitudeAccuracy,heading,speed){return{latitude:latitude||0,longitude:longitude||0,altitude:altitude||0,accuracy:accuracy||0,altitudeAccuracy:altitudeAccuracy||0,heading:heading||0,speed:speed||0}}});ripple.define("platform/w3c/1.0/Position",function(ripple,exports,module){var Coordinates=ripple("platform/w3c/1.0/Coordinates");module.exports=function(){return{coords:new Coordinates,timestamp:(new Date).getTime()}}});ripple.define("platform/w3c/1.0/PositionError",function(ripple,exports,module){var _self=function(){return{code:undefined,message:undefined}};_self.PERMISSION_DENIED="PERMISSION_DENIED";_self.POSITION_UNAVAILABLE="POSITION_UNAVAILABLE";_self.TIMEOUT="TIMEOUT";module.exports=_self});ripple.define("platform/w3c/1.0/Rotation",function(ripple,exports,module){module.exports=function(alpha,beta,gamma){return{alpha:alpha||0,beta:beta||0,gamma:gamma||0}}});ripple.define("platform/w3c/1.0/geolocation",function(ripple,exports,module){var geo=ripple("geo"),Position=ripple("platform/w3c/1.0/Position"),PositionError=ripple("platform/w3c/1.0/PositionError"),_watches={},_self;function createPosition(){var position=new Position,positionInfo=geo.getPositionInfo();position.coords.latitude=positionInfo.latitude;position.coords.longitude=positionInfo.longitude;position.coords.altitude=positionInfo.altitude;position.coords.altitudeAccuracy=positionInfo.altitudeAccuracy;position.coords.accuracy=positionInfo.accuracy;position.coords.heading=positionInfo.heading;position.coords.speed=positionInfo.speed;position.timestamp=positionInfo.timeStamp.getTime();return position}_self={getCurrentPosition:function(onSuccess,onError){var delay=(geo.delay||0)*1e3||1,timeout=geo.timeout;window.setTimeout(function(){if(timeout){var error=new PositionError;error.code=PositionError.TIMEOUT;error.message="position timed out";onError(error)}else{_self.lastPosition=createPosition();onSuccess(_self.lastPosition)}},delay)},watchPosition:function(geolocationSuccess,geolocationError,geolocationOptions){if(!geolocationOptions){geolocationOptions={}}var watchId=(new Date).getTime().toString(),watchObj={},timeout=geolocationOptions.timeout||1e4;watchObj={onSuccess:geolocationSuccess,onError:geolocationError,interval:timeout};_watches[watchId]=watchObj;_watches[watchId].intervalId=window.setInterval(function(){_self.getCurrentPosition(_watches[watchId].onSuccess,_watches[watchId].onError)},timeout);return watchId},lastPosition:null,clearWatch:function(watchId){if(_watches[watchId]){window.clearInterval(_watches[watchId].intervalId);delete _watches[watchId]}}};module.exports=_self});ripple.define("platform/w3c/1.0/navigator",function(ripple,exports,module){var _original=window.navigator,devices=ripple("devices"),_self={};(function(){var key,nav=window.navigator;function _handle(obj,key){return typeof obj[key]!=="function"?obj[key]:function(){return obj[key].apply(obj,Array.prototype.slice.call(arguments))}}for(key in nav){_self[key]=_handle(nav,key)}})();_self.__defineGetter__("userAgent",function(){return devices.getCurrentDevice().userAgent||_original.userAgent});module.exports=_self});ripple.define("platform/web/default/device",function(ripple,exports,module){window.addEventListener("load",function(){var event=ripple("event");event.on("HardwareKey",function(key){event.trigger("HardwareKeyDefault",[key])});delete window.device})});ripple.define("platform/web/default/spec/ui",function(ripple,exports,module){module.exports={plugins:["accelerometer","geoView"]}});ripple.define("platform/web/default/spec",function(ripple,exports,module){module.exports={id:"web",version:"default",name:"Mobile Web",ui:ripple("platform/web/default/spec/ui"),device:{},persistencePrefix:"tinyhippos-",initialize:function(){},objects:{Coordinates:{path:"w3c/1.0/Coordinates"},Position:{path:"w3c/1.0/Position"},PositionError:{path:"w3c/1.0/PositionError"},navigator:{path:"w3c/1.0/navigator",children:{geolocation:{path:"w3c/1.0/geolocation"}}},device:{path:"web/default/device"}}}});ripple.define("platform/webworks.bb10/1.0.0/app",function(ripple,exports,module){var app=ripple("app"),emulatorBridge=ripple("emulatorBridge"),notifications=ripple("notifications"),_self;_self={exit:function(){notifications.openNotification("normal","blackberry.app.exit() was called, in the real world your app will exit, here... you get this notification")}};_self.__defineGetter__("author",function(){return app.getInfo().author});_self.__defineGetter__("authorEmail",function(){return app.getInfo().authorEmail});_self.__defineGetter__("authorURL",function(){return app.getInfo().authorURL});_self.__defineGetter__("copyright",function(){return app.getInfo().copyright});_self.__defineGetter__("description",function(){var desc=app.getInfo().description;return desc[emulatorBridge.window().navigator.language]||desc[emulatorBridge.window().navigator.language.substring(2,0)]||desc["default"]});_self.__defineGetter__("id",function(){return app.getInfo().id});_self.__defineGetter__("license",function(){return app.getInfo().license});_self.__defineGetter__("licenseURL",function(){return app.getInfo().licenseURL});_self.__defineGetter__("name",function(){var name=app.getInfo().name;return name[emulatorBridge.window().navigator.language]||name[emulatorBridge.window().navigator.language.substring(2,0)]||name["default"]});_self.__defineGetter__("version",function(){return app.getInfo().version});_self.__defineGetter__("windowState",function(){return"fullscreen"});module.exports=_self});ripple.define("platform/webworks.bb10/1.0.0/card",function(ripple,exports,module){var camera=ripple("ui/plugins/camera"),event=ripple("event"),card={invokeCamera:function(mode,onSave,onCancel,onInvoke){var type=mode==="video"?"video":"image";event.once("captured-"+type,function(path){return onSave&&onSave(path)});camera.show(type);if(onInvoke){onInvoke("")}}};card.__defineGetter__("CAMERA_MODE_PHOTO",function(){return"photo"});card.__defineGetter__("CAMERA_MODE_VIDEO",function(){return"video"});card.__defineGetter__("CAMERA_MODE_FULL",function(){return"full"});module.exports=card});ripple.define("platform/webworks.bb10/1.0.0/connection",function(ripple,exports,module){var deviceSettings=ripple("deviceSettings"),_self={};_self.__defineGetter__("type",function(){return deviceSettings.retrieve("NetworkStatus.connectionType")});_self.__defineGetter__("UNKNOWN",function(){return"unknown"});_self.__defineGetter__("ETHERNET",function(){return"ethernet"});_self.__defineGetter__("WIFI",function(){return"wifi"});_self.__defineGetter__("BLUETOOTH_DUN",function(){return"bluetooth_dun"});_self.__defineGetter__("USB",function(){return"usb"});_self.__defineGetter__("VPN",function(){return"vpn"});_self.__defineGetter__("BB",function(){return"rim-bb"});_self.__defineGetter__("CELL_2G",function(){return"2g"});_self.__defineGetter__("CELL_3G",function(){return"3g"});_self.__defineGetter__("CELL_4G",function(){return"4g"});_self.__defineGetter__("NONE",function(){return"none"});module.exports=_self});ripple.define("platform/webworks.bb10/1.0.0/context-menu-actions",function(ripple,exports,module){var event=ripple("event"),_handlers={},_customHandlers={},_currentContext,menuActions;function customItemHandler(actionId){event.trigger("contextmenu.executeMenuAction",[actionId])}function setCurrentContext(context){_currentContext=context}function addCustomItem(actionId){if(_customHandlers[actionId]){return false}else{_customHandlers[actionId]=customItemHandler.bind(this,actionId);return true}}function removeCustomItem(actionId){if(_customHandlers[actionId]){delete _customHandlers[actionId]}}function clearCustomHandlers(){_customHandlers={}}function runHandler(actionId){if(_customHandlers[actionId]){_customHandlers[actionId](actionId)}}menuActions={handlers:_handlers,runHandler:runHandler,clearCustomHandlers:clearCustomHandlers,setCurrentContext:setCurrentContext,addCustomItem:addCustomItem,removeCustomItem:removeCustomItem};module.exports=menuActions});ripple.define("platform/webworks.bb10/1.0.0/context-menu-event",function(ripple,exports,module){var event=ripple("event");function trapAndDisableSingleClickEvent(mouseevent){mouseevent.preventDefault();mouseevent.stopPropagation();mouseevent.target.removeEventListener("click",trapAndDisableSingleClickEvent,true)}function isWithinAnchor(mouseevent){var el=mouseevent.target;while(typeof el!=="undefined"&&el!==null&&el.tagName.toLowerCase()!=="a"&&el.tagName.toLowerCase()!=="body"){
el=el.parentNode}return el.tagName.toLowerCase()==="a"?el:false}function isWithinContextMenu(mouseevent){var el=mouseevent.target;while(typeof el!=="undefined"&&el!==null&&el.getAttribute&&el.getAttribute("id")!=="contextMenu"){el=el.parentNode}return el.getAttribute&&el.getAttribute("id")==="contextMenu"}function hasTextSelection(mouseevent){var el=mouseevent.target,doc=el.ownerDocument,win=doc.defaultView,selection=win.getSelection(),range=selection.rangeCount>0?selection.getRangeAt(0):null;return range!==null&&range.toString().length>0}function onWindowLongpress(mouseevent){if(isWithinContextMenu(mouseevent)){return}var context={name:null},formFieldTags=["input","select","textarea"],target=mouseevent.target,tagName=target.tagName.toLowerCase(),linkElement=isWithinAnchor(mouseevent);if(hasTextSelection(mouseevent)){context.name="TEXT"}else if(tagName==="img"&&linkElement){context.name="IMAGE_LINK";mouseevent.target.addEventListener("click",trapAndDisableSingleClickEvent,true)}else if(tagName==="img"){context.name="IMAGE"}else if(linkElement){context.name="LINK";mouseevent.target.addEventListener("click",trapAndDisableSingleClickEvent,true)}else if(formFieldTags.indexOf(tagName)!==-1){context.name="INPUT"}if(linkElement){context.text=linkElement.textContent;context.url=linkElement.getAttribute("href")||""}if(context.name!==null){event.trigger("ContextMenuEvent",[context],true)}}event.on("LongPressEvent",onWindowLongpress)});ripple.define("platform/webworks.bb10/1.0.0/context-menu",function(ripple,exports,module){var _self,ui=ripple("ui"),event=ripple("event"),utils=ripple("utils"),contextMenuUI=ripple("ui/plugins/context-menu"),_currentContext,_enabled=true,_actions=ripple("platform/webworks.bb10/1.0.0/context-menu-actions"),_customContextItems={},_storedCallbacks={},defaultContextMenuItems={IMAGE_LINK:["Open","CopyLink","CopyImageLink","Cancel"],IMAGE:["CopyImageLink","SaveImage"],LINK:["Copy","CopyLink","Cancel"],INPUT:["Cut","Copy","ClearField","Cancel"],TEXT:["Copy","Cancel"],ALL:["Cancel"]},CONTEXT_ALL="ALL",CONTEXT_LINK="LINK",CONTEXT_IMAGE_LINK="IMAGE_LINK",CONTEXT_IMAGE="IMAGE",CONTEXT_TEXT="TEXT",CONTEXT_INPUT="INPUT";function generateMenuItems(menuItems){var items=[],extensionUrl=document.getElementById("extension-url").innerHTML,imagePath="images/webworks/bb10/",hasCancel=false,i;for(i=0;i<menuItems.length;i++){switch(menuItems[i]){case"ClearField":items.push({label:"Clear Field",actionId:"ClearField",imageUrl:extensionUrl+imagePath+"Browser_Cancel_Selection.png"});break;case"SendLink":break;case"SendImageLink":break;case"FullMenu":break;case"Delete":break;case"Cancel":items.push({label:"Dismiss Selection",actionId:"Cancel",imageUrl:extensionUrl+imagePath+"Browser_Cancel_Selection.png",isDelete:true});hasCancel=true;break;case"Cut":items.push({label:"Cut",actionId:"Cut",imageUrl:extensionUrl+imagePath+"Browser_Cut.png"});break;case"Copy":items.push({label:"Copy",actionId:"Copy",imageUrl:extensionUrl+imagePath+"Browser_Copy.png"});break;case"Paste":items.push({label:"Paste",actionId:"Paste",imageUrl:extensionUrl+imagePath+"crosscutmenu_paste.png"});break;case"Select":items.push({label:"Select",actionId:"Select",imageUrl:extensionUrl+imagePath+"crosscutmenu_paste.png"});break;case"AddLinkToBookmarks":break;case"CopyLink":items.push({label:"Copy Link",actionId:"CopyLink",imageUrl:extensionUrl+imagePath+"Browser_CopyLink.png"});break;case"OpenLinkInNewTab":break;case"OpenLink":items.push({label:"Open",actionId:"OpenLink",imageUrl:extensionUrl+imagePath+"Browser_OpenLink.png"});break;case"SaveLinkAs":items.push({label:"Save Link as",actionId:"SaveLinkAs",imageUrl:extensionUrl+imagePath+"Browser_SaveLink.png"});break;case"SaveImage":items.push({label:"Save Image",actionId:"SaveImage",imageUrl:extensionUrl+imagePath+"Browser_SaveImage.png"});break;case"CopyImageLink":items.push({label:"Copy Image Link",actionId:"CopyImageLink",imageUrl:extensionUrl+imagePath+"Browser_CopyImageLink.png"});break;case"ViewImage":break;case"Search":break;case"ShareLink":if(!/^local|^file/.test(_currentContext.url)){items.push({label:"Share Link",actionId:"ShareLink",imageUrl:extensionUrl+imagePath+"Browser_ShareLink.png"})}break;case"ShareImage":break;case"InspectElement":items.push({label:"Inspect Element",actionId:"InspectElement",imageUrl:extensionUrl+imagePath+"generic_81_81_placeholder.png"});break}}if(!hasCancel){items.push({label:"Cancel",actionId:"Cancel",imageUrl:extensionUrl+imagePath+"Browser_Cancel_Selection.png",isDelete:true})}if(_currentContext&&_currentContext.url&&_currentContext.text){items.push({headText:_currentContext.text,subheadText:_currentContext.url})}return items}function addItem(fail,args){var contexts=args.contexts,action=args.action,context;if(!action.actionId||action.actionId===""){return fail("Cannot add item. actionId is not valid")}else if(!_actions.addCustomItem(action.actionId)){return fail('Cannot add item. A menu item with the actionId "'+action.actionId+'" already exists.')}for(context in contexts){if(!_customContextItems[contexts[context]]){_customContextItems[contexts[context]]={}}_customContextItems[contexts[context]][action.actionId]=action}}function removeItemFromAllContexts(actionId){var everyContext=[CONTEXT_ALL,CONTEXT_LINK,CONTEXT_IMAGE_LINK,CONTEXT_IMAGE,CONTEXT_INPUT,CONTEXT_TEXT],context;for(context in everyContext){if(_customContextItems[everyContext[context]]){delete _customContextItems[everyContext[context]][actionId]}}}function removeItem(success,fail,args){var contexts=args.contexts,actionId=args.actionId,context;for(context in contexts){if(contexts[context]===CONTEXT_ALL){removeItemFromAllContexts(actionId);delete _storedCallbacks[actionId]}else{if(_customContextItems[contexts[context]]){delete _customContextItems[contexts[context]][actionId];delete _storedCallbacks[actionId]}}}_actions.removeCustomItem(actionId)}function addCustomItemsForContext(items,context){var customItem,lastItem=items.slice(-1)[0],lastItemIsDelete=lastItem&&lastItem.isDelete;if(_customContextItems[context]){for(customItem in _customContextItems[context]){if(lastItemIsDelete){items.splice(-1,0,_customContextItems[context][customItem])}else{items.push(_customContextItems[context][customItem])}}}}function addCustomItems(menuItems,currentContext){addCustomItemsForContext(menuItems,CONTEXT_ALL);addCustomItemsForContext(menuItems,currentContext)}function showMenu(){var menuItems=generateMenuItems(defaultContextMenuItems[_currentContext.name]);if(_enabled){addCustomItems(menuItems,_currentContext);ui.showOverlay("contextMenuWindow",function(){contextMenuUI.init();contextMenuUI.setMenuOptions(menuItems);contextMenuUI.peekContextMenu(true)},true)}}event.on("ContextMenuEvent",function(context){_currentContext=context;_actions.setCurrentContext(context);showMenu()});event.on("contextmenu.executeMenuAction",function(actionId){var callback=_storedCallbacks[actionId];if(callback){_storedCallbacks[actionId]()}});_self={addItem:function(contexts,action,callback){if(typeof callback!=="function"){callback=function(){}}_storedCallbacks[action.actionId]=callback;addItem(function(message){throw message},{contexts:contexts,action:action})},removeItem:function(contexts,actionId){removeItem(function(){},function(){},{contexts:contexts,actionId:actionId})}};Object.defineProperty(_self,"enabled",{get:function(){return _enabled},set:function(val){_enabled=val}});utils.defineReadOnlyField(_self,"CONTEXT_ALL","ALL");utils.defineReadOnlyField(_self,"CONTEXT_LINK","LINK");utils.defineReadOnlyField(_self,"CONTEXT_IMAGE_LINK","IMAGE_LINK");utils.defineReadOnlyField(_self,"CONTEXT_IMAGE","IMAGE");utils.defineReadOnlyField(_self,"CONTEXT_INPUT","INPUT");utils.defineReadOnlyField(_self,"CONTEXT_TEXT","TEXT");module.exports=_self});ripple.define("platform/webworks.bb10/1.0.0/coreFileSystem",function(ripple,exports,module){var _self,utils=ripple("utils"),_appInfo=ripple("app").getInfo(),_io=ripple("platform/webworks.bb10/1.0.0/io"),_appId=_appInfo.id,_accessShared,_paths={sandboxed:"/rippleFileSystem/"+_appId+"/sandbox",unSandboxed:"/rippleFileSystem/"+_appId+"/unsandboxed"};_accessShared=_appInfo.permissions&&_appInfo.permissions.some(function(value){return value==="access_shared"});function _map(array,callback){var map=[],i;for(i=0;i<array.length;i++){map[i]=callback(array[i],i)}return map}function _hasAccessToPath(path,entry){path=path.match(/^\//)?path:entry.fullPath;return!(!_accessShared&&path.match(_io.sharedFolder))}function _massagePath(path,direction,sandboxed,isRoot){var prefix;if(direction==="outgoing"){utils.forEach(_paths,function(item){path=path.replace(new RegExp(item),"")});path=path===""?"/":path}else if(direction==="incoming"&&(path.match(/^\//)||isRoot)){prefix=sandboxed?_paths.sandboxed:_paths.unSandboxed;path=prefix+"/"+path.replace(/^\//,"")}return path}function _createReader(de,fs,sandboxed){var readEntriesSuccess;function internalSuccess(entries){var myEntries=_map(entries,function(entry){if(entry.isDirectory){return _self.createDirectoryEntry(entry,fs,sandboxed)}else{return _self.createFileEntry(entry,fs,sandboxed)}});readEntriesSuccess(myEntries)}return{readEntries:function(success,fail){readEntriesSuccess=success;de.createReader().readEntries(internalSuccess,fail)}}}function _getDirectory(directoryEntry,fs,sandboxed,path,options,dirSuccess,fail){var isRoot=directoryEntry.fullPath==="/";if(!_hasAccessToPath(path,directoryEntry)){fail(FileError.NOT_FOUND_ERR);return}function internalDirSuccess(de){dirSuccess(_self.createDirectoryEntry(de,fs,sandboxed))}path=_massagePath(path,"incoming",sandboxed,isRoot);directoryEntry.getDirectory(path,options,internalDirSuccess,fail)}function _getFile(directoryEntry,fs,sandboxed,path,options,fileSuccess,fail){var isRoot=directoryEntry.fullPath==="/";if(!_hasAccessToPath(path,directoryEntry)){fail(FileError.NOT_FOUND_ERR);return}function internalFileSuccess(fe){fileSuccess(_self.createFileEntry(fe,fs,sandboxed))}path=_massagePath(path,"incoming",sandboxed,isRoot);directoryEntry.getFile(path,options,internalFileSuccess,fail)}_self={createDirectoryEntry:function(de,fs,sandboxed){var isRoot=de.fullPath==="/",myDE;myDE={fullPath:_massagePath(de.fullPath,"outgoing",sandboxed,isRoot),isDirectory:de.isDirectory,isFile:de.isFile,name:de.name,filesystem:fs,createReader:function(){return _createReader(de,fs,sandboxed)},getDirectory:function(path,options,dirSuccess,fail){_getDirectory(de,fs,sandboxed,path,options,dirSuccess,fail)},getFile:function(path,options,dirSuccess,fail){_getFile(de,fs,sandboxed,path,options,dirSuccess,fail)},removeRecursively:de.removeRecursively.bind(de),copyTo:function(directoryEntry,name,success,fail){function internalSuccess(de){success(_self.createDirectoryEntry(de,fs))}de.copyTo(directoryEntry.prototype,name,internalSuccess,fail)},getMetadata:de.getMetadata.bind(de),getParent:de.getParent.bind(de),moveTo:function(directoryEntry,name,success,fail){function internalSuccess(de){success(_self.createDirectoryEntry(de,fs))}de.moveTo(directoryEntry.prototype,fs,name,internalSuccess,fail)},remove:de.remove.bind(de),toURL:de.toURL.bind(de)};myDE.__proto__=de;return myDE},createFileEntry:function(fe,fs,sandboxed){var myFE={fullPath:_massagePath(fe.fullPath,"outgoing",sandboxed),isDirectory:fe.isDirectory,isFile:fe.isFile,name:fe.name,filesystem:fs,createWriter:fe.createWriter.bind(fe),file:fe.file.bind(fe),copyTo:function(directoryEntry,name,success,fail){function internalSuccess(fe){success(_self.createFileEntry(fe,fs,sandboxed))}fe.copyTo(directoryEntry.prototype,fs,name,internalSuccess,fail)},getMetadata:fe.getMetadata.bind(fe),getParent:fe.getParent.bind(fe),moveTo:function(directoryEntry,name,success,fail){function internalSuccess(fe){success(_self.createFileEntry(fe,fs,sandboxed))}fe.moveTo(directoryEntry.prototype,fs,name,internalSuccess,fail)},remove:fe.remove.bind(fe),toURL:fe.toURL.bind(fe)};myFE.__proto__=fe;return myFE}};module.exports=_self});ripple.define("platform/webworks.bb10/1.0.0/device",function(ripple,exports,module){var devices=ripple("devices"),_self={};_self.__defineGetter__("softwareVersion",function(){return devices.getCurrentDevice().osVersion});_self.__defineGetter__("hardwareId",function(){return devices.getCurrentDevice().hardwareId});module.exports=_self});ripple.define("platform/webworks.bb10/1.0.0/dialog",function(ripple,exports,module){var _self,ui=ripple("ui"),event=ripple("event"),isDialogVisible=false,visibleDialogArgs,utils=ripple("utils");function getButtonsForDialogType(dialogType){switch(dialogType){case _self.D_OK:return["Ok"];case _self.D_SAVE:return["Save","Discard"];case _self.D_DELETE:return["Delete","Cancel"];case _self.D_YES_NO:return["Yes","No"];case _self.D_OK_CANCEL:return["Ok","Cancel"];default:throw new Error("Invalid dialog type: "+dialogType)}}function closeDialog(){var buttonsDiv=document.getElementById("dialog-buttons"),messageDiv=document.getElementById("dialog-message");ui.hideOverlay("dialog-window",function(){buttonsDiv.innerHTML="";messageDiv.innerHTML="";isDialogVisible=false})}event.on("LayoutChanged",function(){if(isDialogVisible){closeDialog();_self.ask(visibleDialogArgs)}});function ask(args,callback){if(!args){throw"No arguments provided"}else if(!args.buttons||!args.message){throw"Invalid arguments"}visibleDialogArgs=args;ui.showOverlay("dialog-window",function(dialog){var container=document.getElementById("viewport-container"),height=window.getComputedStyle(container,null).getPropertyValue("height"),width=window.getComputedStyle(container,null).getPropertyValue("width"),sizeDiv=document.getElementById("dialog-wrapper"),positionDiv=document.getElementById("dialog-window"),titleDiv=document.getElementById("dialog-title"),buttonsDiv=document.getElementById("dialog-buttons"),messageDiv=document.getElementById("dialog-message"),position,size;if(!messageDiv||!buttonsDiv){return}dialog.setAttribute("style","display:-webkit-box;height:"+height+"; width:"+width+";");position="overlay-dialog";size="overlay-dialog-wrapper";if(args.settings&&args.settings.position){position+=" overlay-dialog-"+args.settings.position}if(args.settings&&args.settings.size){size+=" overlay-dialog-wrapper-"+args.settings.size}positionDiv.setAttribute("class",position);sizeDiv.setAttribute("class",size);titleDiv.innerHTML=args.settings&&args.settings.title?args.settings.title:"";messageDiv.innerHTML=args.message;isDialogVisible=true;args.buttons.forEach(function(button){var buttonElement=utils.createElement("input",{type:"button",value:button});buttonElement.addEventListener("click",function(){var buttonIndex=args.buttons.indexOf(button);closeDialog();callback(buttonIndex)});buttonsDiv.appendChild(buttonElement)})},true)}_self={customAskAsync:function(message,choices,callback,settings){ask({message:message,buttons:choices,settings:settings},function(response){if(callback){callback(response)}})},standardAskAsync:function(message,type,callback,settings){var choices=getButtonsForDialogType(type);ask({message:message,buttons:choices,settings:settings},function(response){if(callback){callback(response)}})}};_self.__defineGetter__("D_OK",function(){return 0});_self.__defineGetter__("D_SAVE",function(){return 1});_self.__defineGetter__("D_DELETE",function(){return 2});_self.__defineGetter__("D_YES_NO",function(){return 3});_self.__defineGetter__("D_OK_CANCEL",function(){return 4});_self.__defineGetter__("BOTTOM",function(){return"bottomCenter"});_self.__defineGetter__("CENTER",function(){return"middleCenter"});_self.__defineGetter__("TOP",function(){return"topCenter"});_self.__defineGetter__("SIZE_FULL",function(){return"full"});_self.__defineGetter__("SIZE_LARGE",function(){return"large"});_self.__defineGetter__("SIZE_MEDIUM",function(){return"medium"});_self.__defineGetter__("SIZE_SMALL",function(){return"small"});_self.__defineGetter__("SIZE_TALL",function(){return"tall"});module.exports=_self});ripple.define("platform/webworks.bb10/1.0.0/event",function(ripple,exports,module){var event=ripple("event"),settings=ripple("deviceSettings"),app=ripple("app"),cons=ripple("console"),events={batterystatus:{callbacks:[],feature:"blackberry.system"},batterylow:{callbacks:[],feature:"blackberry.system"},batterycritical:{callbacks:[],feature:"blackberry.system"},connectionchange:{callbacks:[],feature:"blackberry.connection"},invoked:{callbacks:[],feature:"blackberry.invoked"},swipedown:{callbacks:[],feature:"blackberry.app"},resume:{callbacks:[],feature:"blackberry.app"},pause:{callbacks:[],feature:"blackberry.app"},languagechange:{callbacks:[],feature:"blackberry.system"},regionchange:{callbacks:[],feature:"blackberry.system"},keyboardOpening:{callbacks:[],feature:"blackberry.app"},keyboardOpened:{callbacks:[],feature:"blackberry.app"},keyboardClosed:{callbacks:[],feature:"blackberry.app"},keyboardClosing:{callbacks:[],feature:"blackberry.app"},keyboardPosition:{callbacks:[],feature:"blackberry.app"}};function _apply(eventName,args){events[eventName].callbacks.forEach(function(cb){cb.apply(null,args)})}event.on("KeyboardOpened",function(){_apply("keyboardOpened")});event.on("KeyboardOpening",function(){_apply("keyboardOpening")});event.on("KeyboardClosed",function(){_apply("keyboardClosed")});event.on("KeyboardClosing",function(){_apply("keyboardClosing")});event.on("KeyboardPosition",function(yPos){_apply("keyboardPosition",[yPos])});event.on("DeviceBatteryStateChanged",function(charging){var info={isPlugged:charging,level:parseInt(settings.retrieve("battery.level"),10)};_apply("batterystatus",[info])});event.on("DeviceBatteryLevelChanged",function(level){var info={isPlugged:settings.retrieve("battery.state"),level:parseInt(level,10)};_apply("batterystatus",[info]);if(level==="14"){_apply("batterylow",[info])}if(level==="4"){_apply("batterycritical",[info])}});event.on("DeviceConnectionChanged",function(info){_apply("connectionchange",[info])});event.on("LanguageChanged",function(lang){_apply("languagechange",[lang])});event.on("RegionChanged",function(lang){_apply("regionchange",[lang])});event.on("AppInvoke",function(invokeInfo){var invokeTargets=app.getInfo().invokeTargets;if(!invokeTargets){cons.log("The application cannot be invoked, please add a rim:invoke-target node in config.xml");return}if(invokeTargets.some(function(target){return target.filter.some(function(filter){return(!filter.property||filter.property&&filter.property[0]["@attributes"].var==="exts"&&filter.property[0]["@attributes"].value.split(",").some(function(value){return invokeInfo.extension.match(value)})||filter.property&&filter.property[0]["@attributes"].var==="uris"&&filter.property[0]["@attributes"].value.split(",").some(function(value){return invokeInfo.uri.match(value)}))&&filter.action.some(function(action){return invokeInfo.action.match(action["#text"][0].replace("*",""))})&&filter["mime-type"].some(function(type){return invokeInfo.type.match(type["#text"][0].replace("*",""))})})})){_apply("invoked",[invokeInfo])}else{cons.log("Cannot invoke application, values enter to not match values in rim:invoke-target in config.xml")}});event.on("AppSwipeDown",function(){_apply("swipedown")});event.on("AppResume",function(){_apply("resume")});event.on("AppPause",function(){_apply("pause")});module.exports={addEventListener:function(type,func){this.removeEventListener(type,func);if(!events[type]){throw new Error("Cannot register a handler for the "+type+" event, because it does not seem to be supported.")}if(!app.getInfo().features||app.getInfo().features[events[type].feature]){events[type].callbacks.push(func)}else{throw"Cannot register a handler for the "+type+" event. Please add the '"+events[type].feature+"' to your config.xml."}},removeEventListener:function(type,func){var idx=events[type]?events[type].callbacks.indexOf(func):-1;if(idx>=0){delete events[type].callbacks[idx]}}}});ripple.define("platform/webworks.bb10/1.0.0/identity",function(ripple,exports,module){var deviceSettings=ripple("deviceSettings"),_self={};_self.__defineGetter__("uuid",function(){return deviceSettings.retrieve("identity.uuid")});_self.__defineGetter__("IMEI",function(){return deviceSettings.retrieve("identity.IMEI")});module.exports=_self});ripple.define("platform/webworks.bb10/1.0.0/invoke",function(ripple,exports,module){var notifications=ripple("notifications"),utils=ripple("utils"),_self={};function _fail(onError){if(onError&&typeof onError==="function"){onError("invalid invocation request")}}_self.invoke=function(request,onSuccess,onError){var argsString="";if(!request){_fail(onError);return}else{if(request){utils.forEach(request,function(arg,key){argsString+=key+" = "+arg+"</br>"});notifications.openNotification("normal","Requested to invoke external application with the following arguments:</br> "+argsString+"</br>")}else{_fail(onError);return}}};_self.__defineGetter__("ACTION_OPEN",function(){return"bb.action.OPEN"});_self.__defineGetter__("ACTION_VIEW",function(){return"bb.action.VIEW"});_self.__defineGetter__("ACTION_SHARE",function(){return"bb.action.SHARE"});module.exports=_self});ripple.define("platform/webworks.bb10/1.0.0/io",function(ripple,exports,module){var app=ripple("app"),notifications=ripple("notifications"),utils=ripple("utils"),permissions=app.getInfo().permissions,_sandbox=true,_self={};_self.__defineSetter__("sandbox",function(sandbox){utils.validateArgumentType(sandbox,"boolean","sandbox cannot be set!");if(sandbox===false){if(!utils.some(permissions,function(item){return item==="access_shared"})){notifications.openNotification("error","You're asking for a non-sandboxed file system, however you have not specified the access_shared permission in config.xml under the rim:permissions node")}}if(_sandbox!==sandbox){if(sandbox===false){}_sandbox=sandbox}});_self.__defineGetter__("sandbox",function(){return _sandbox});_self.__defineGetter__("SDCard",function(){return"/webworksBB10/SDCard"});_self.__defineGetter__("home",function(){return"/webworksBB10/"+app.getInfo().id+"/home"});_self.__defineGetter__("sharedFolder",function(){return"/webworksBB10/sharedFolder"});module.exports=_self});ripple.define("platform/webworks.bb10/1.0.0/navigator",function(ripple,exports,module){var nav=ripple("platform/w3c/1.0/navigator"),utils=ripple("utils"),deviceSettings=ripple("deviceSettings"),_self={};utils.mixin(nav,_self);_self.__defineGetter__("language",function(){return deviceSettings.retrieve("system.language")});_self.__defineSetter__("language",function(value){deviceSettings.persist("system.language",value)});module.exports=_self});ripple.define("platform/webworks.bb10/1.0.0/spec/config",function(ripple,exports,module){var utils=ripple("utils");module.exports={fileName:"config.xml",validateVersion:function(){return true},extractInfo:function(config){if(!config){return null}var widgetInfo={},widgetFeatures=config.widget.children.feature.validationResult,widgetDescription=config.widget.children.description.validationResult,widgetName=config.widget.children.name.validationResult,accessUrls=config.widget.children.access.validationResult,accessFeatures=config.widget.children.access.children.feature.validationResult,permissions=config.rawJSON.widget[0]["rim:permissions"]&&config.rawJSON.widget[0]["rim:permissions"][0]["rim:permit"]||[],toFeature=function(validationResult){return{id:validationResult.attributes.id.value,required:!validationResult.attributes.required||validationResult.attributes.required.value,URIs:[]}};widgetInfo.id=config.widget.validationResult[0].attributes.id.value;widgetInfo.icon=config.widget.children.icon.validationResult[0].attributes.src.value;widgetInfo.version=config.widget.validationResult[0].attributes.version.value;widgetInfo.author=config.widget.children.author.validationResult[0].value;widgetInfo.authorEmail=config.widget.children.author.validationResult[0].attributes.email.value;widgetInfo.authorURL=config.widget.children.author.validationResult[0].attributes.href.value;widgetInfo.copyright=config.widget.children.author.validationResult[0].attributes["rim:copyright"].value;widgetInfo.invokeTargets=config.rawJSON.widget[0]["rim:invoke-target"];if(config.widget.children.license.validationResult[0]){widgetInfo.license=config.widget.children.license.validationResult[0].value;widgetInfo.licenseURL=config.widget.children.license.validationResult[0].attributes.href.value}widgetInfo.description=widgetDescription.reduce(function(description,item){if(item.valid){description[item.attributes["xml:lang"].value||"default"]=item.value}return description},{});widgetInfo.name=widgetName.reduce(function(name,item){if(item.valid){name[item.attributes["xml:lang"].value||"default"]=item.value}return name},{});widgetInfo.permissions=permissions.map(function(item){return item["#text"][0]});widgetInfo.features=widgetFeatures.reduce(function(features,validationResult){if(validationResult.valid){var feature=toFeature(validationResult);feature.URIs.push({value:utils.location().href,subdomains:true});features=features||{};features[feature.id]=feature}return features},{});widgetInfo.features=accessUrls.map(function(access){return{uri:access.attributes.uri.value,subdomains:access.attributes.subdomains.value,features:accessFeatures?accessFeatures.filter(function(f){return f.node&&f.node.parentNode&&f.node.parentNode.attributes.uri.value===access.attributes.uri.value}):null}}).reduce(function(result,access){return access.features?access.features.reduce(function(features,validationResult){var feature=features[validationResult.attributes.id.value]||toFeature(validationResult);feature.URIs.push({value:access.uri,subdomains:access.subdomains});features[feature.id]=feature;return features},result):result},widgetInfo.features);return widgetInfo},schema:{rootElement:"widget",widget:{nodeName:"widget",required:true,occurrence:1,attributes:{xmlns:{attributeName:"xmlns",required:true,type:"list",listValues:["http://www.w3.org/ns/widgets"]},"xmlns:rim":{attributeName:"xmlns:rim",required:true,type:"list",listValues:["http://www.blackberry.com/ns/widgets"]},"xml:lang":{attributeName:"xml:lang",required:false,type:"iso-language"},id:{attributeName:"id",required:false,type:"string"},version:{attributeName:"version",required:false,type:"string"},"rim:header":{attributeName:"rim:header",required:false,type:"string"},"rim:backButton":{attributeName:"rim:backButton",required:false,type:"string"}},children:{name:{nodeName:"name",required:true,occurrence:0,attributes:{"xml:lang":{attributeName:"xml:lang",required:false,type:"iso-language"},"its:dir":{attributeName:"its:dir",required:false,type:"list",listValues:["rtl","ltr","lro","rlo"]}}},description:{nodeName:"description",required:false,occurrence:0,attributes:{"xml:lang":{attributeName:"xml:lang",required:false,type:"iso-language"},"its:dir":{attributeName:"its:dir",required:false,type:"list",listValues:["rtl","ltr","lro","rlo"]}}},icon:{nodeName:"icon",required:false,occurrence:0,attributes:{src:{attributeName:"src",type:"string",required:true},"rim:hover":{attributeName:"rim:hover",type:"boolean",required:false}}},author:{nodeName:"author",required:false,occurrence:0,attributes:{href:{attributeName:"href",type:"string",required:false},"rim:copyright":{attributeName:"rim:copyright",type:"string",required:false},email:{attributeName:"email",type:"string",required:false},"xml:lang":{attributeName:"xml:lang",required:false,type:"iso-language"},"its:dir":{attributeName:"its:dir",required:false,type:"list",listValues:["rtl","ltr","lro","rlo"]}}},license:{nodeName:"license",required:false,occurrence:0,attributes:{href:{attributeName:"href",type:"string",required:false},"xml:lang":{attributeName:"xml:lang",required:false,type:"iso-language"},"its:dir":{attributeName:"its:dir",required:false,type:"list",listValues:["rtl","ltr","lro","rlo"]}}},"rim:cache":{nodeName:"rim:cache",required:false,occurrence:1,attributes:{disableAllCache:{attributeName:"disableAllCache",required:false,type:"boolean"},aggressiveCacheAge:{attributeName:"aggressiveCacheAge",required:false,type:"number"},maxCacheSizeTotal:{attributeName:"maxCacheSizeTotal",required:false,type:"number"},maxCacheSizeItem:{attributeName:"maxCacheSizeItem",required:false,type:"number"}}},access:{nodeName:"access",required:false,occurrence:0,attributes:{uri:{attributeName:"uri",required:true,type:"string"},subdomains:{attributeName:"subdomains",required:false,type:"boolean"}},children:{feature:{nodeName:"feature",required:false,occurrence:0,attributes:{id:{attributeName:"id",required:true,type:"string"},required:{attributeName:"required",required:false,type:"boolean"},version:{attributeName:"version",required:false,type:"string"}}}}},feature:{nodeName:"feature",required:false,occurrence:0,attributes:{id:{attributeName:"id",required:true,type:"string"},required:{attributeName:"required",required:false,type:"boolean"},version:{attributeName:"version",required:false,type:"string"}}},"rim:loadingScreen":{nodeName:"rim:loadingScreen",required:false,occurrence:1,attributes:{backgroundColor:{attributeName:"backgroundColor",required:false,type:"string"},backgroundImage:{attributeName:"backgroundImage",required:false,type:"string"},foregroundImage:{attributeName:"foregroundImage",required:false,type:"string"},onRemotePageLoad:{attributeName:"onRemotePageLoad",required:false,type:"boolean"},onLocalPageLoad:{attributeName:"onLocalPageLoad",required:false,type:"boolean"},onFirstLaunch:{attributeName:"onFirstLaunch",required:false,type:"boolean"}},children:{"rim:transitionEffect":{nodeName:"rim:transitionEffect",required:false,occurrence:1,attributes:{type:{attributeName:"type",required:true,type:"list",listValues:["slidePush","slideOver","fadeIn","fadeOut","wipeIn","wipeOut","zoomIn","zoomOut"]},duration:{attributeName:"duration",required:false,type:"number"},direction:{attributeName:"direction",required:false,type:"list",listValues:["left","right","up","down"]}}}}},"rim:invoke-target":{nodeName:"rim:invoke-target",required:false,occurrence:0,attributes:{id:{attributeName:"id",required:true,type:"string"}},children:{type:{nodeName:"type",required:true,occurrence:1},"require-source-permissions":{nodeName:"require-source-permissions",required:false,occurrence:0},filter:{nodeName:"filter",required:false,occurrence:0,children:{action:{nodeName:"action",required:true,occurrence:0},"mime-type":{nodeName:"mime-type",required:true,occurrence:0},property:{nodeName:"property",required:false,occurrence:0,attributes:{"var":{attributeName:"var",required:false,type:"string"},value:{attributeName:"value",required:false,type:"string"}}}}}}},"rim:connection":{nodeName:"rim:connection",required:false,occurrence:1,attributes:{timeout:{attributeName:"timeout",required:false,type:"number"}},children:{id:{nodeName:"id",required:false,occurrence:0}}},"rim:permissions":{nodeName:"rim:permissions",required:false,occurrence:1,children:{"rim:permit":{nodeName:"rim:permit",required:false,occurrence:0,type:"list",listValues:["access_shared","record_audio","read_geolocation","read_device_identifying_information","use_camera"]}}},"rim:navigation":{nodeName:"rim:navigation",required:false,occurrence:1,attributes:{mode:{attributeName:"mode",required:false,type:"list",listValues:["focus"]}}},content:{nodeName:"content",required:true,occurrence:1,attributes:{src:{attributeName:"src",required:true,type:"string"},type:{attributeName:"type",required:false,type:"string"},charset:{attributeName:"charset",required:false,type:"string"}}}}}}}});ripple.define("platform/webworks.bb10/1.0.0/spec/device",function(ripple,exports,module){var event=ripple("event");module.exports={NetworkStatus:{connectionType:{name:"Connection Type",control:{type:"select",value:"ethernet"},options:{unknown:"UNKNOWN",ethernet:"ETHERNET",wifi:"WIFI",bluetooth_dun:"BLUETOOTH_DUN",usb:"USB",vpn:"VPN","rim-bb":"BB","2g":"CELL_2G","3g":"CELL_3G","4g":"CELL_4G",none:"NONE"},callback:function(setting,oldSetting){event.trigger("DeviceConnectionChanged",[{oldType:oldSetting,newType:setting}])}}},identity:{uuid:{name:"uuid",control:{type:"text",value:"43A8C489"}},IMEI:{
name:"IMEI",control:{type:"text",value:"012345678901234"}}},system:{language:{name:"language",control:{type:"text",value:"en-US"},callback:function(setting){event.trigger("LanguageChanged",[setting])}},region:{name:"region",control:{type:"text",value:"en-CA"},callback:function(setting){event.trigger("RegionChanged",[setting])}}},battery:{state:{name:"Handset is Charging",control:{type:"checkbox",value:true},callback:function(setting){event.trigger("DeviceBatteryStateChanged",[setting])}},level:{name:"Charge Level (% remaining)",control:{type:"select",value:100},options:function(){var i,optionList={};for(i=0;i<=100;i++){optionList[i]=i}return optionList}(),callback:function(setting){event.trigger("DeviceBatteryLevelChanged",[setting])}},chargingTime:{name:"Charging Time",control:{type:"number",value:0},callback:function(setting){event.trigger("DeviceBatteryChargingTimeChanged",[setting])}},dischargingTime:{name:"Discharging Time",control:{type:"number",value:1e3},callback:function(setting){event.trigger("DeviceBatteryDischargingTimeChanged",[setting])}}},Perimeters:{perimeter:{name:"Perimeter",control:{type:"select",value:"Consumer"},options:{Enterprise:"Enterprise",Consumer:"Consumer"}}}}});ripple.define("platform/webworks.bb10/1.0.0/spec/events",function(ripple,exports,module){var event=ripple("event");function keyboard(){return ripple("ui/plugins/virtualKeyboard")}module.exports={"blackberry.event.swipedown":{callback:function(){event.trigger("AppSwipeDown")}},"blackberry.event.resume":{callback:function(){event.trigger("AppResume")}},"blackberry.event.pause":{callback:function(){event.trigger("AppPause")}},"blackberry.event.keyboardOpened":{callback:function(){event.trigger("KeyboardOpened")}},"blackberry.event.keyboardOpening":{callback:function(){event.trigger("KeyboardOpening")}},"blackberry.event.keyboardClosed":{callback:function(){event.trigger("KeyboardClosed")}},"blackberry.event.keyboardClosing":{callback:function(){event.trigger("KeyboardClosing")}},"open virtual keyboard":{callback:function(){keyboard().open()}},"close virtual keyboard":{callback:function(){keyboard().close()}}}});ripple.define("platform/webworks.bb10/1.0.0/spec/ui",function(ripple,exports,module){module.exports={plugins:["accelerometer","deviceSettings","geoView","platformEvents","widgetConfig","build","invoke","virtualKeyboard"]}});ripple.define("platform/webworks.bb10/1.0.0/spec",function(ripple,exports,module){module.exports={id:"webworks.bb10",version:"1.0.0",name:"BlackBerry 10 WebWorks",persistencePrefix:"rim-bb10-",ui:ripple("platform/webworks.bb10/1.0.0/spec/ui"),device:ripple("platform/webworks.bb10/1.0.0/spec/device"),config:ripple("platform/webworks.bb10/1.0.0/spec/config"),events:ripple("platform/webworks.bb10/1.0.0/spec/events"),initialize:function(){var event=ripple("event"),_console=ripple("console"),emulatorBridge=ripple("emulatorBridge");ripple("platform/webworks.bb10/1.0.0/context-menu-event");event.once("TinyHipposLoaded",function(){var doc=emulatorBridge.document(),evt=doc.createEvent("Events");evt.initEvent("webworksready",true,true);doc.dispatchEvent(evt);_console.log("fired webworksready event!")})},objects:{Coordinates:{path:"w3c/1.0/Coordinates"},Position:{path:"w3c/1.0/Position"},PositionError:{path:"w3c/1.0/PositionError"},navigator:{path:"webworks.bb10/1.0.0/navigator",children:{geolocation:{path:"w3c/1.0/geolocation"},webkitBattery:{path:"webworks.bb10/1.0.0/webkitBattery"}}},webkitResolveLocalFileSystemURL:{path:"webworks.bb10/1.0.0/webkitResolveLocalFileSystemURL"},webkitRequestFileSystem:{path:"webworks.bb10/1.0.0/webkitRequestFileSystem"},blackberry:{children:{event:{path:"webworks.bb10/1.0.0/event"},app:{path:"webworks.bb10/1.0.0/app",feature:"blackberry.app"},invoke:{path:"webworks.bb10/1.0.0/invoke",feature:"blackberry.invoke",children:{card:{path:"webworks.bb10/1.0.0/card",feature:"blackberry.invoke.card"}}},identity:{path:"webworks.bb10/1.0.0/identity",feature:"blackberry.identity"},system:{path:"webworks.bb10/1.0.0/system"},connection:{path:"webworks.bb10/1.0.0/connection"},io:{path:"webworks.bb10/1.0.0/io",feature:"blackberry.io"},ui:{children:{dialog:{path:"webworks.bb10/1.0.0/dialog",feature:"blackberry.ui.dialog"}}}}}}}});ripple.define("platform/webworks.bb10/1.0.0/system",function(ripple,exports,module){var deviceSettings=ripple("deviceSettings"),devices=ripple("devices"),app=ripple("app"),utils=ripple("utils"),_self;function _is(feature){return{allowedFor:function(location){return feature&&feature.URIs.some(function(uri){return uri.value===location||location.indexOf(uri.value)>=0&&uri.subdomains})}}}_self={hasCapability:function(capability){var capabilities=devices.getCurrentDevice().capabilities;return capabilities?capabilities.some(function(type){return type===capability}):false},hasPermission:function(desiredModule){var info=app.getInfo(),feature=info.features?info.features[desiredModule]:null;return feature===null||_is(feature).allowedFor(utils.location().href)?_self.ALLOW:_self.DENY}};_self.__defineGetter__("ALLOW",function(){return 0});_self.__defineGetter__("DENY",function(){return 1});_self.__defineGetter__("softwareVersion",function(){return devices.getCurrentDevice().osVersion});_self.__defineGetter__("hardwareId",function(){return devices.getCurrentDevice().hardwareId});_self.__defineGetter__("language",function(){return deviceSettings.retrieve("system.language")});_self.__defineGetter__("region",function(){return deviceSettings.retrieve("system.region")});module.exports=_self});ripple.define("platform/webworks.bb10/1.0.0/webkitBattery",function(ripple,exports,module){var deviceSettings=ripple("deviceSettings"),event=ripple("event"),handlers={levelchange:[],chargingtimechange:[],dischargingtimechange:[],chargingchange:[]},call=function(func){return func&&func()},battery={onchargingchange:null,onchargingtimechange:null,ondischargingtimechange:null,onlevelchange:null,addEventListener:function(type,callback){if(!handlers[type])return;if(handlers[type].indexOf(callback)<0){handlers[type].push(callback)}},removeEventListener:function(type,callback){if(!handlers[type])return;var idx=handlers[type].indexOf(callback);if(idx<0)return;handlers[type].splice(idx,1)}};battery.__defineGetter__("charging",function(){return deviceSettings.retrieveAsBoolean("battery.state")});battery.__defineGetter__("chargingTime",function(){return deviceSettings.retrieveAsInt("battery.chargingTime")});battery.__defineGetter__("dischargingTime",function(){return deviceSettings.retrieveAsInt("battery.dischargingTime")});battery.__defineGetter__("level",function(){return deviceSettings.retrieveAsInt("battery.level")/100});event.on("DeviceBatteryLevelChanged",function(){handlers.levelchange.forEach(call);return battery.onlevelchange&&battery.onlevelchange()});event.on("DeviceBatteryChargingTimeChanged",function(){handlers.chargingtimechange.forEach(call);return battery.onchargingtimechange&&battery.onchargingtimechange()});event.on("DeviceBatteryStateChanged",function(){handlers.chargingchange.forEach(call);return battery.onchargingchange&&battery.onchargingchange()});event.on("DeviceBatteryDischargingTimeChanged",function(){handlers.dischargingtimechange.forEach(call);return battery.ondischargingtimechange&&battery.ondischargingtimechange()});module.exports=battery});ripple.define("platform/webworks.bb10/1.0.0/webkitRequestFileSystem",function(ripple,exports,module){var _orig=window.webkitRequestFileSystem,fs=ripple("fs"),_console=ripple("console"),_io=ripple("platform/webworks.bb10/1.0.0/io"),_appId=ripple("app").getInfo().id,_sandboxedDirectoryEntry,_unSandboxedDirectoryEntry,_paths={sandboxed:"/rippleFileSystem/"+_appId+"/sandbox",unSandboxed:"/rippleFileSystem/"+_appId+"/unsandboxed"};function fsInitError(e){_console.error("Something went wrong initializing the WebWorks HTML5 FileSystem!");_console.error(e)}fs.mkdir(_paths.sandboxed,function(dirEntry){_sandboxedDirectoryEntry=dirEntry},fsInitError,{recursive:true});fs.mkdir(_paths.unSandboxed,function(dirEntry){_unSandboxedDirectoryEntry=dirEntry;fs.mkdir(_paths.unSandboxed+_io.SDCard,function(){},fsInitError,{recursive:true},true);fs.mkdir(_paths.unSandboxed+_io.home,function(){},fsInitError,{recursive:true},true);fs.mkdir(_paths.unSandboxed+_io.sharedFolder,function(){fs.mkdir(_paths.unSandboxed+_io.sharedFolder+"/Books",function(){},fsInitError.bind(),true);fs.mkdir(_paths.unSandboxed+_io.sharedFolder+"/Documents",function(){},fsInitError.bind(),true);fs.mkdir(_paths.unSandboxed+_io.sharedFolder+"/Downloads",function(){},fsInitError.bind(),true);fs.mkdir(_paths.unSandboxed+_io.sharedFolder+"/Misc",function(){},fsInitError.bind(),true);fs.mkdir(_paths.unSandboxed+_io.sharedFolder+"/Music",function(){},fsInitError.bind(),true);fs.mkdir(_paths.unSandboxed+_io.sharedFolder+"/Photos",function(){},fsInitError.bind(),true);fs.mkdir(_paths.unSandboxed+_io.sharedFolder+"/Print",function(){},fsInitError.bind(),true);fs.mkdir(_paths.unSandboxed+_io.sharedFolder+"/Videos",function(){},fsInitError.bind(),true);fs.mkdir(_paths.unSandboxed+_io.sharedFolder+"/Voice",function(){},fsInitError.bind(),true)},fsInitError,{recursive:true},true)},fsInitError,{recursive:true},true);module.exports=function(type,size,success,fail){var _internalFS={},_sandboxed=_io.sandbox,_type=_sandboxed?type:"PERSISTENT",coreFS=ripple("platform/webworks.bb10/1.0.0/coreFileSystem");function _internalSuccess(fileSystem){_internalFS.name=fileSystem.name;_internalFS.root=coreFS.createDirectoryEntry(_sandboxed?_sandboxedDirectoryEntry:_unSandboxedDirectoryEntry,fileSystem,_sandboxed);_internalFS.root.__proto__=_sandboxed?_sandboxedDirectoryEntry:_unSandboxedDirectoryEntry;_internalFS.__proto__=fileSystem;success(_internalFS)}_orig(_type,size,_internalSuccess,fail)}});ripple.define("platform/webworks.bb10/1.0.0/webkitResolveLocalFileSystemURL",function(ripple,exports,module){var _orig=window.webkitResolveLocalFileSystemURL,coreFS=ripple("platform/webworks.bb10/1.0.0/coreFileSystem");module.exports=function(url,success,fail){var sandboxed=ripple("platform/webworks.bb10/1.0.0/io").sandbox;function internalSuccess(entry){var myEntry;if(entry.isDirectory){myEntry=coreFS.createDirectoryEntry(entry,entry.fileSystem,sandboxed)}else{myEntry=coreFS.createFileEntry(entry,entry.fileSystem,sandboxed)}success(myEntry)}_orig(url,internalSuccess,fail)}});ripple.define("platform/webworks.core/2.0.0/XMLHttpRequest",function(ripple,exports,module){module.exports={create:function(server){var XHR=window.XMLHttpRequest,webworks=ripple(server);return function(){var _url,_async,xhr=new XHR,origMethods={open:xhr.open,send:xhr.send,setRequestHeader:xhr.setRequestHeader};function onreadystatechange(){if(typeof xhr.onreadystatechange==="function"){xhr.onreadystatechange()}}function statemachine(getResult){var state=0,incState=function(prev,baton){state++;if(_async){baton.take();window.setTimeout(baton.pass,1)}},setResponse=function(result){xhr.__defineGetter__("status",function(){return 200});xhr.__defineGetter__("responseText",function(){return result!==null&&result!==undefined?JSON.stringify(result):null})};xhr.__defineGetter__("readyState",function(){return state});jWorkflow.order(incState).andThen(onreadystatechange).andThen(incState).andThen(onreadystatechange).andThen(incState).andThen(onreadystatechange).andThen(getResult).andThen(setResponse).andThen(incState).andThen(onreadystatechange).start()}xhr.setRequestHeader=function(){if(!_url.match(/^webworks:\/\//)){origMethods.setRequestHeader.apply(xhr,Array.prototype.slice.call(arguments))}};xhr.open=function(method,url,async){_url=url;_async=async;if(!_url.match(/^webworks:\/\//)){origMethods.open.apply(xhr,Array.prototype.slice.call(arguments))}};xhr.send=function(post){if(!_url.match(/^webworks:\/\//)){origMethods.send.apply(xhr,Array.prototype.slice.call(arguments));return}var params=_url.match(/\?(.*)$/),objPath=_url.match(/^webworks:\/\/([^\?]*)/)[1].split("/"),apiMethod=objPath.reduce(function(obj,name){return obj[name]},webworks),postParams={},get={};if(params){params[1].split("&").forEach(function(param){var pair=param.split("="),key=decodeURIComponent(pair[0]),value=decodeURIComponent(pair[1]);get[key]=value==="undefined"?undefined:JSON.parse(value)})}if(post){post.split("&").forEach(function(param){var pair=param.split("="),value;try{value=JSON.parse(decodeURIComponent(pair[1]))}catch(e){value=pair[1]==="undefined"?undefined:pair[1]}postParams[pair[0]]=value})}statemachine(function(prev,baton){return apiMethod(get,postParams,baton)})};return xhr}}}});ripple.define("platform/webworks.core/2.0.0/client/FileProperties",function(ripple,exports,module){function FileProperties(props){props=props||{};function _get(val){return function(){return props[val]}}this.__defineGetter__("dateCreated",_get("dateCreated"));this.__defineGetter__("dateModified",_get("dateModified"));this.__defineGetter__("directory",_get("directory"));this.__defineGetter__("fileExtension",_get("fileExtension"));this.__defineGetter__("isHidden",_get("isHidden"));this.__defineGetter__("isReadonly",_get("isReadonly"));this.__defineGetter__("mimeType",_get("mimeType"));this.__defineGetter__("size",_get("size"))}module.exports=FileProperties});ripple.define("platform/webworks.core/2.0.0/client/dialog",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_uri="blackberry/ui/dialog/",_self;function getButtonsForDialogType(dialogType){switch(dialogType){case _self.D_OK:return["Ok"];case _self.D_SAVE:return["Save","Discard"];case _self.D_DELETE:return["Delete","Cancel"];case _self.D_YES_NO:return["Yes","No"];case _self.D_OK_CANCEL:return["Ok","Cancel"];default:throw new Error("Invalid dialog type: "+dialogType)}}_self={customAskAsync:function(message,choices,callback,settings){return transport.call(_uri+"ask",{async:true,get:{message:message,buttons:choices,settings:settings}},function(response){if(callback){callback(response)}})},standardAskAsync:function(message,type,callback,settings){var choices=getButtonsForDialogType(type);return transport.call(_uri+"ask",{async:true,get:{message:message,buttons:choices,settings:settings}},function(response){if(callback){callback(response)}})}};_self.__defineGetter__("D_OK",function(){return 0});_self.__defineGetter__("D_SAVE",function(){return 1});_self.__defineGetter__("D_DELETE",function(){return 2});_self.__defineGetter__("D_YES_NO",function(){return 3});_self.__defineGetter__("D_OK_CANCEL",function(){return 4});_self.__defineGetter__("BOTTOM",function(){return"bottomCenter"});_self.__defineGetter__("CENTER",function(){return"middleCenter"});_self.__defineGetter__("TOP",function(){return"topCenter"});_self.__defineGetter__("SIZE_FULL",function(){return"full"});_self.__defineGetter__("SIZE_LARGE",function(){return"large"});_self.__defineGetter__("SIZE_MEDIUM",function(){return"medium"});_self.__defineGetter__("SIZE_SMALL",function(){return"small"});_self.__defineGetter__("SIZE_TALL",function(){return"tall"});module.exports=_self});ripple.define("platform/webworks.core/2.0.0/client/events",function(ripple,exports,module){var _handlers=[],_self;_self={eventsMap:{getHandlerById:function(handlerId){return _handlers[handlerId]},addHandler:function(handler){_handlers.push(handler);return _handlers.length-1},removeHandler:function(handlerId){if(handlerId>-1&&handlerId<_handlers.length){delete _handlers[handlerId]}}},registerEventHandler:function(eventName,eventCallback){return _self.eventsMap.addHandler(eventCallback)},getEventHandler:function(handlerId){return _self.eventsMap.getHandlerById(handlerId)}};module.exports=_self});ripple.define("platform/webworks.core/2.0.0/client/io/dir",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_uri="blackberry/io/dir/",FILE="file://";function _prunePrefix(path){return path.replace(new RegExp("^"+FILE),"")}function _addPrefix(path){return FILE+path}module.exports={createNewDir:function(path){transport.call(_uri+"createNewDir",{post:{path:_prunePrefix(path)}})},deleteDirectory:function(path,recursive){transport.call(_uri+"deleteDirectory",{post:{path:_prunePrefix(path),recursive:recursive}})},exists:function(path){return transport.call(_uri+"exists",{post:{path:_prunePrefix(path)}})},getParentDirectory:function(path){return _addPrefix(transport.call(_uri+"getParentDirectory",{post:{path:_prunePrefix(path)}}))},listDirectories:function(path){return transport.call(_uri+"listDirectories",{post:{path:_prunePrefix(path)}})},listFiles:function(path){return transport.call(_uri+"listFiles",{post:{path:_prunePrefix(path)}})},rename:function(path,newName){transport.call(_uri+"rename",{post:{path:_prunePrefix(path),newName:newName}})}}});ripple.define("platform/webworks.core/2.0.0/client/io/file",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_uri="blackberry/io/file/",FILE="file://",_onFileOpened;function _prunePrefix(path){return path.replace(new RegExp("^"+FILE),"")}module.exports={copy:function(from,to){transport.call(_uri+"copy",{post:{from:_prunePrefix(from),to:_prunePrefix(to)}})},deleteFile:function(path){transport.call(_uri+"deleteFile",{post:{path:_prunePrefix(path)}})},exists:function(path){return transport.call(_uri+"exists",{post:{path:_prunePrefix(path)}})},getFileProperties:function(path){var properties=transport.call(_uri+"getFileProperties",{post:{path:_prunePrefix(path)}});properties.directory=FILE+properties.directory;return properties},open:function(path){transport.call(_uri+"open",{post:{path:_prunePrefix(path)}})},readFile:function(path,onFileOpened,async){async=async===false?false:true;var uri=_uri+"readFile",args={post:{path:_prunePrefix(path),async:async}},callResult;_onFileOpened=onFileOpened;if(async){transport.poll(uri,args,function(data){if(_onFileOpened){_onFileOpened(FILE+data.fullPath,data.blobData)}return false})}else{callResult=transport.call(uri,args);_onFileOpened(FILE+callResult.fullPath,callResult.blobData)}},rename:function(path,newName){transport.call(_uri+"rename",{post:{path:_prunePrefix(path),newName:newName}})},saveFile:function(path,blob){transport.call(_uri+"saveFile",{post:{path:_prunePrefix(path),blob:blob}})}}});ripple.define("platform/webworks.core/2.0.0/client/system",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_uri="blackberry/system/",_self;_self={hasCapability:function(capability){return transport.call(_uri+"hasCapability",{get:{capability:capability}})},hasDataCoverage:function(){return transport.call(_uri+"hasDataCoverage")},hasPermission:function(desiredModule){return transport.call(_uri+"hasPermission",{get:{desiredModule:desiredModule}})},isMassStorageActive:function(){return transport.call(_uri+"isMassStorageActive")}};_self.__defineGetter__("model",function(){return transport.call(_uri+"model")});_self.__defineGetter__("scriptApiVersion",function(){return transport.call(_uri+"scriptApiVersion")});_self.__defineGetter__("softwareVersion",function(){return transport.call(_uri+"softwareVersion")});_self.__defineGetter__("ALLOW",function(){return 0});_self.__defineGetter__("DENY",function(){return 1});_self.__defineGetter__("PROMPT",function(){return 2});_self.__defineGetter__("NOT_SET",function(){return 3});module.exports=_self});ripple.define("platform/webworks.core/2.0.0/client/transport",function(ripple,exports,module){var _self;function RemoteFunctionCall(functionUri){var params={},postString="",postParams={};function composeUri(){var uri="webworks://"+functionUri,paramCount=1,param;for(param in params){if(params.hasOwnProperty(param)){if(paramCount===1){uri+="?"}else{uri+="&"}uri+=param+"="+params[param];paramCount++}uri=uri.replace(/\&$/,"")}return uri}function createXhrRequest(uri,isAsync){var request=new XMLHttpRequest,paramCount=1,param;for(param in postParams){if(postParams.hasOwnProperty(param)){postString+=param+"="+postParams[param]+"&";paramCount++}}postString=postString.replace(/\&$/,"");request.open("POST",uri,isAsync);request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");return request}this.addParam=function(name,value){params[name]=encodeURIComponent(JSON.stringify(value))};this.addPostParam=function(name,value){postParams[name]=encodeURIComponent(JSON.stringify(value))};this.makeSyncCall=function(success,error){var requestUri=composeUri(),request=createXhrRequest(requestUri,false),response,errored,cb,data;request.send(postString);response=JSON.parse(request.responseText||"null");errored=response.code<0;cb=errored?error:success;data=errored?response.msg:response.data;if(cb){cb(data,response)}else if(errored){throw data}return data};this.makeAsyncCall=function(success,error){var requestUri=composeUri(),request=createXhrRequest(requestUri,true);request.onreadystatechange=function(){if(request.readyState===4&&request.status===200){var response=JSON.parse(request.responseText||"null"),cb=response.code<0?error:success,data=response.code<0?response.msg:response.data;return cb&&cb(data,response)}};request.send(postString)}}_self={call:function(url,opts,success,error){var request=new RemoteFunctionCall(url),name;opts=opts||{};if(opts.get){for(name in opts.get){if(Object.hasOwnProperty.call(opts.get,name)){request.addParam(name,opts.get[name])}}}if(opts.post){for(name in opts.post){if(Object.hasOwnProperty.call(opts.post,name)){request.addPostParam(name,opts.post[name])}}}return opts.async?request.makeAsyncCall(success,error):request.makeSyncCall(success,error)},poll:function(url,opts,callback){opts=opts||{};opts.async=true;_self.call(url,opts,function(data,response){if(callback(data,response)){_self.poll(url,opts,callback)}})}};module.exports=_self});ripple.define("platform/webworks.core/2.0.0/client/utils",function(ripple,exports,module){var _blobs={};function _blobBuilder(){var BlobBuilder=BlobBuilder||WebKitBlobBuilder;return new BlobBuilder}module.exports={parseURL:function(theUrl){function parseUri(str){var o=parseUri.options,m=o.parser[o.strictMode?"strict":"loose"].exec(str),uri={},i=14;while(i--){uri[o.key[i]]=m[i]||""}uri[o.q.name]={};uri[o.q.arrayName]=[];uri[o.key[12]].replace(o.q.parser,function($0,$1,$2){if($1){uri[o.q.name][$1]=$2;uri[o.q.arrayName].push($2)}});return uri}parseUri.options={strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",arrayName:"queryArray",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};parseUri.strictMode="strict";var uri=parseUri(theUrl),retVal={getURLParameter:function(key){return uri.queryKey[key]},getURLParameterByIndex:function(index){return uri.queryArray[index]}};if(uri["port"]===""){if(uri["protocol"]==="http"){uri["port"]="80"}else if(uri["protocol"]==="https"){uri["port"]="443"}else{uri["port"]="0"}}retVal.__defineGetter__("host",function(){return uri["host"]});retVal.__defineGetter__("port",function(){return parseInt(uri["port"],10)});return retVal},generateUniqueId:function(){return Math.floor(Math.random()*Number.MAX_VALUE)},blobToString:function(blob){return _blobs[blob.id]},stringToBlob:function(string){var id=Math.uuid(undefined,16),blob=_blobBuilder(),finalBlob;_blobs[id]=string;blob.append(string);finalBlob=blob.getBlob();finalBlob.id=id;finalBlob.length=finalBlob.size;return finalBlob}}});ripple.define("platform/webworks.core/2.0.0/fs",function(ripple,exports,module){var db=ripple("db"),utils=ripple("utils"),event=ripple("event"),_cache={},_self;function _get(path){return path.replace(/^\//,"").split("/").reduce(function(obj,token){return token===""?obj:obj.children?obj.children[token]||null:null},_cache)}function _getInfo(path){var parent=("/"+path.replace(/^\//,"").replace(/\/$/,"")).split("/"),name=parent.splice(parent.length-1,1).join(""),ext=name.split(".");return{name:name,extension:ext.length>1?ext[ext.length-1]:"",hidden:name.length>0&&name[0]==="."||false,parent:parent.join("/")||"/"}}function _set(path,obj){var parent=_cache,tokens=path.replace(/^\//,"").replace(/\/$/,"").split("/"),child=tokens.splice(tokens.length-1,1).join("");tokens.forEach(function(token){parent=parent.children[token]});parent.children=parent.children||{};obj.properties=obj.properties||{};parent.children[child]=obj}function _delete(path){var parent=_cache,tokens=path.replace(/^\//,"").split("/"),child=tokens.splice(tokens.length-1,1).join("");tokens.forEach(function(token){parent=parent.children[token]});delete parent.children[child]}function _save(){db.saveObject("db-filesystem",_cache)}_self={initialize:function(){_cache=db.retrieveObject("db-filesystem")||{};event.trigger("WebWorksFileSystemInitialized",null,true)},ls:function(path,success,error){try{var dir=_get(path),items=[];if(dir){utils.forEach(dir.children,function(item){if(!item.isDirectory){item.file=function(callback){callback({})}}items.push(item)})}else{items={}}success(utils.copy(items))}catch(e){e.code=1;error(e)}},rm:function(path,success){_delete(path);_save();success()},rmdir:function(path,success){_delete(path);_save();success()},mkdir:function(path,success,error){var entry=_get(path),info=_getInfo(path);if(!entry){_set(path,{name:info.name,isDirectory:true,fullPath:path});entry=_get(path)}_save();if(entry){success(utils.copy(entry))}else{error({code:1})}},mv:function(from,to,success,error){try{var fromEntry=_get(from),toInfo=_getInfo(to);fromEntry.fullPath=to;fromEntry.name=toInfo.name;_set(to,fromEntry);_delete(from);_save();success(utils.copy(_get(to)))}catch(e){e.code=1;error(e)}},touch:function(path,success){if(!_get(path)){_set(path,{fullPath:path})}_save();success(utils.copy(_get(path)))},cp:function(from,to,success,error){try{var fromEntry=_get(from);fromEntry.fullPath=to;_set(to,fromEntry);_save();success(utils.copy(_get(to)))}catch(e){e.code=1;error(e)}},stat:function(path,success){var entry=_get(path);success(utils.copy(entry))},write:function(path,contents,success){var info=_getInfo(path);_set(path,{lastModifiedDate:new Date,name:info.name,fullPath:path,isDirectory:false,properties:{type:"",size:contents.size},data:contents,file:function(callback){callback({})}});success(utils.copy(_get(path)))},read:function(path,success,error){var entry=_get(path);if(entry){success(utils.copy(entry.data))}else{error({code:1})}}};module.exports=_self});ripple.define("platform/webworks.core/2.0.0/fsCache",function(ripple,exports,module){var utils=ripple("utils"),_console=ripple("console"),constants=ripple("constants"),event=ripple("event"),fs=ripple("platform/webworks.core/2.0.0/fs"),bbUtils=ripple("platform/webworks.core/2.0.0/client/utils"),FileProperties=ripple("platform/webworks.core/2.0.0/client/FileProperties"),_cache={},_self;function _createPath(path){var parts=path.replace(/^\//,"").replace(/\/$/,"").split("/"),workflow=jWorkflow.order();parts.forEach(function(part,index){var dir="/"+utils.copy(parts).splice(0,index+1).join("/");workflow.andThen(function(prev,baton){baton.take();fs.mkdir(dir,baton.pass,baton.pass)})});workflow.start(_self.refresh)}event.on("WebWorksFileSystemInitialized",function(){_createPath("/SDCard");_createPath("/store/home/user/music");_createPath("/store/home/user/pictures");_createPath("/store/home/user/videos");_createPath("/store/home/user/videos");_createPath("/accounts/1000/appdata/emulatedapp/data");_createPath("/accounts/1000/appdata/emulatedapp/shared/bookmarks");_createPath("/accounts/1000/appdata/emulatedapp/shared/books");_createPath("/accounts/1000/appdata/emulatedapp/shared/camera");_createPath("/accounts/1000/appdata/emulatedapp/shared/documents");_createPath("/accounts/1000/appdata/emulatedapp/shared/downloads");_createPath("/accounts/1000/appdata/emulatedapp/shared/misc");_createPath("/accounts/1000/appdata/emulatedapp/shared/music");_createPath("/accounts/1000/appdata/emulatedapp/shared/photos");_createPath("/accounts/1000/appdata/emulatedapp/shared/print");_createPath("/accounts/1000/appdata/emulatedapp/shared/videos");_createPath("/accounts/1000/appdata/emulatedapp/shared/voice")});function _fsError(e){_self.refresh();if(e.code!==1){_console.error("FileSystem error (code "+e.code+")")}}function _walk(path,parent){fs.ls(path,function(entries){parent.children=parent.children||{};entries.forEach(function(entry){parent.children[entry.name]=entry;parent.children[entry.name].properties={};if(entry.isDirectory){_walk(entry.fullPath,entry)}else{entry.file(function(file){utils.mixin(file,parent.children[entry.name].properties)});fs.read(entry.fullPath,function(data){parent.children[entry.name].data=data},function(e){console.error(e)})}})},function(e){console.error(e)})}function _get(path){return path.replace(/^\//,"").split("/").reduce(function(obj,token){return token===""?obj:obj&&obj.children?obj.children[token]||null:null},_cache)}function _getInfo(path){var parent=("/"+path.replace(/^\//,"").replace(/\/$/,"")).split("/"),name=parent.splice(parent.length-1,1).join(""),ext=name.split(".");return{name:name,extension:ext.length>1?ext[ext.length-1]:"",hidden:name.length>0&&name[0]==="."||false,parent:parent.join("/")||"/"}}function _set(path,obj){var parent=_cache,tokens=path.replace(/^\//,"").replace(/\/$/,"").split("/"),child=tokens.splice(tokens.length-1,1).join("");tokens.forEach(function(token){parent=parent.children[token]});parent.children=parent.children||{};obj.properties=obj.properties||{};parent.children[child]=obj}function _delete(path){var parent=_cache,tokens=path.replace(/^\//,"").replace(/\/$/,"").split("/"),child=tokens.splice(tokens.length-1,1).join("");tokens.forEach(function(token){parent=parent.children[token]});delete parent.children[child]}_self={refresh:function(){_cache={};_walk("/",_cache)},file:{exists:function(path){var entry=_get(path);return!!(entry&&!entry.isDirectory)},deleteFile:function(path){_delete(path);fs.rm(path,function(){},_fsError)},copy:function(from,to){var fromEntry=_get(from);_set(to,{fullPath:to,properties:fromEntry.properties,data:fromEntry.data});fs.cp(from,to,function(entry){entry.file(function(file){entry.properties=entry.properties||{};utils.mixin(file,entry.properties);_set(to,entry)})},_fsError)},getFileProperties:function(path){var entry=_get(path),info=_getInfo(path);fs.stat(path,function(){},_fsError);return new FileProperties({dateCreated:entry.properties.lastModifiedDate||entry.lastModifiedDate,dateModified:entry.properties.lastModifiedDate||entry.lastModifiedDate,directory:info.parent,fileExtension:info.extension,isHidden:info.hidden,isReadonly:false,mimeType:entry.properties.type,size:entry.properties.size})},rename:function(path,newName){_self.dir.rename(path,newName)},readFile:function(path,success,async){var entry=_get(path);async=async===false?async:true;if(!async){success(bbUtils.stringToBlob(entry.data))}else{fs.read(path,function(data){var blob=bbUtils.stringToBlob(data);if(async){success(blob)}entry.data=data;_set(path,entry)},_fsError)}},saveFile:function(path,blob){var data=bbUtils.blobToString(blob);_set(path,{lastModifiedDate:new Date,fullPath:path,isDirectory:false,properties:{type:"",size:blob.size},data:data});fs.write(path,data,function(entry){entry.data=data;entry.file(function(file){entry.properties=entry.properties||{};utils.mixin(file,entry.properties);_set(path,entry)})},_fsError)}},dir:{createNewDir:function(path){var entry=_get(path),info=_getInfo(path);if(!entry){_set(path,{name:info.name,isDirectory:true,fullPath:path})}fs.mkdir(path,function(entry){_set(path,entry)},_fsError)},deleteDirectory:function(path,recursive){_delete(path);if(recursive){fs.rm(path,function(){},_fsError,{recursive:recursive})}else{fs.rmdir(path,function(){},_fsError);
}},exists:function(path){var entry=_get(path);return!!(entry&&entry.isDirectory)},getFreeSpaceForRoot:function(){function _du(obj,size){utils.forEach(obj,function(child){if(child.isDirectory&&child.children){size+=_du(child.children,size)}else if(child.properties&&child.properties.size){size+=child.properties.size}});return size}return constants.FS_SIZE-_du(_cache.children,0)},getParentDirectory:function(path){path="/"+path.replace(/^\//,"").replace(/\/$/,"");var entry=_get(path),array=path.split("/");return entry?array.splice(0,array.length-1).join("/")||"/":null},listDirectories:function(path){var dir=_get(path),directories=[];utils.forEach(dir.children,function(item){if(item.isDirectory){directories.push(item.name)}});fs.ls(path,function(){},_fsError);return directories},listFiles:function(path){var dir=_get(path),files=[];if(dir){utils.forEach(dir.children,function(item){if(!item.isDirectory){files.push(item.name)}})}fs.ls(path,function(){},_fsError);return files},rename:function(path,newName){var info=_getInfo(path),parent=info.parent,oldName=info.name,from=(parent==="/"?"":parent)+"/"+oldName,to=(parent==="/"?"":parent)+"/"+newName;_delete(from);_set(to,{name:info.name,fullPath:path});fs.mv(from,to,function(entry){_set(to,entry)},_fsError)},getRootDirs:function(){return _self.dir.listDirectories("/")}}};module.exports=_self});ripple.define("platform/webworks.core/2.0.0/select",function(ripple,exports,module){var utils=ripple("utils"),_select,_predicates={"==":function(left,right){return left===right},"!=":function(left,right){return left!==right},"<":function(left,right){return left<right},">":function(left,right){return left>right},"<=":function(left,right){return left<=right},">=":function(left,right){return left>=right},REGEX:function(left,right){return left&&left.match(new RegExp(right))},CONTAINS:function(left,right){return left.indexOf(right)>=0}};function isFilter(field){return field&&field.operator!==undefined&&field.operator!==null}function extractValue(item,field){return field.split(".").reduce(function(value,prop){return value[prop]},item)}function copy(items){return utils.reduce(items,function(array,item){array.push(item);return array},[])}_select={ops:{find:{0:"!=",1:"==",2:"<",3:"<=",4:">",5:">=",8:"REGEX",16:"AND",32:"OR",64:"CONTAINS"},phone:{0:"!=",1:"==",2:"<",3:"<=",4:">",5:">=",8:"AND",16:"OR",32:"CONTAINS"}},from:function(items){var _getPredicate=function(filter,operators){var noOp=function(){return false},operator=function(){var result=operators[filter.operator]||filter.operator,exists=function(op){return result===op};return utils.some(operators,exists)?result:""}();return function(item){var left=extractValue(item,filter.leftField),right=filter.rightField,predicate=_predicates[operator]||noOp;return filter.negate?!predicate(left,right):predicate(left,right)}},_applyFilter=function(filter,operators){var result=[],left,right,op;if(isFilter(filter.leftField)&&isFilter(filter.rightField)){left=_select.from(items).where(filter.leftField);right=_select.from(items).where(filter.rightField);op=operators[filter.operator]||filter.operator;switch(op){case"AND":result=left.filter(function(item){return right.indexOf(item)>=0});break;case"OR":result=left.concat(right.filter(function(item){return left.indexOf(item)<0}));break}if(filter.negate){result=utils.filter(items,function(item){return result.indexOf(item)<0})}}else{result=utils.filter(items,_getPredicate(filter,operators))}return result},_orderBy,_max,_direction,_self={orderBy:function(prop,dir){_orderBy=prop;_direction=dir||"asc";return _self},max:function(max){_max=max;return _self},where:function(filter,ops){var result=isFilter(filter)?_applyFilter(filter,ops||_select.ops.find):copy(items);result.sort(function(a,b){if(a[_orderBy]<b[_orderBy]){return _direction==="asc"?-1:1}else if(a[_orderBy]>b[_orderBy]){return _direction==="asc"?1:-1}return 0});return result.slice(0,_max===null||_max===-1?undefined:_max)}};return _self}};module.exports=_select});ripple.define("platform/webworks.core/2.0.0/server/dialog",function(ripple,exports,module){var event=ripple("event"),ui=ripple("ui"),utils=ripple("utils"),isDialogVisible=false,visibleDialogArgs,_self;function closeDialog(){var buttonsDiv=document.getElementById("dialog-buttons"),messageDiv=document.getElementById("dialog-message");ui.hideOverlay("dialog-window",function(){buttonsDiv.innerHTML="";messageDiv.innerHTML="";isDialogVisible=false})}event.on("LayoutChanged",function(){if(isDialogVisible){closeDialog();_self.ask(visibleDialogArgs)}});_self={ask:function(args,post,baton){if(!args){throw"No arguments provided"}else if(!args.buttons||!args.message){throw"Invalid arguments"}baton.take();visibleDialogArgs=args;ui.showOverlay("dialog-window",function(dialog){var container=document.getElementById("viewport-container"),height=window.getComputedStyle(container,null).getPropertyValue("height"),width=window.getComputedStyle(container,null).getPropertyValue("width"),sizeDiv=document.getElementById("dialog-wrapper"),positionDiv=document.getElementById("dialog-window"),titleDiv=document.getElementById("dialog-title"),buttonsDiv=document.getElementById("dialog-buttons"),messageDiv=document.getElementById("dialog-message"),position,size;if(!messageDiv||!buttonsDiv){return}dialog.setAttribute("style","display:-webkit-box;height:"+height+"; width:"+width+";");position="overlay-dialog";size="overlay-dialog-wrapper";if(args.settings&&args.settings.position){position+=" overlay-dialog-"+args.settings.position}if(args.settings&&args.settings.size){size+=" overlay-dialog-wrapper-"+args.settings.size}positionDiv.setAttribute("class",position);sizeDiv.setAttribute("class",size);titleDiv.innerHTML=args.settings&&args.settings.title?args.settings.title:"";messageDiv.innerHTML=args.message;isDialogVisible=true;args.buttons.forEach(function(button){var buttonElement=utils.createElement("input",{type:"button",value:button});buttonElement.addEventListener("click",function(){var buttonIndex=args.buttons.indexOf(button);closeDialog();baton.pass({code:1,data:buttonIndex})});buttonsDiv.appendChild(buttonElement)})},true)}};module.exports=_self});ripple.define("platform/webworks.core/2.0.0/server/io/dir",function(ripple,exports,module){var cache=ripple("platform/webworks.core/2.0.0/fsCache");function _packet(data){return{code:1,data:data}}module.exports={createNewDir:function(get,post){cache.dir.createNewDir(post.path);return _packet()},deleteDirectory:function(get,post){cache.dir.deleteDirectory(post.path,post.recursive);return _packet()},exists:function(get,post){return _packet(cache.dir.exists(post.path))},getParentDirectory:function(get,post){return _packet(cache.dir.getParentDirectory(post.path))},listDirectories:function(get,post){return _packet(cache.dir.listDirectories(post.path))},listFiles:function(get,post){return _packet(cache.dir.listFiles(post.path))},rename:function(get,post){cache.dir.rename(post.path,post.newName);return _packet()}}});ripple.define("platform/webworks.core/2.0.0/server/io/file",function(ripple,exports,module){var cache=ripple("platform/webworks.core/2.0.0/fsCache"),notifications=ripple("notifications");function _packet(data){return{code:1,data:data}}module.exports={copy:function(get,post){cache.file.copy(post.from,post.to);return _packet()},deleteFile:function(get,post){cache.file.deleteFile(post.path);return _packet()},exists:function(get,post){return _packet(cache.file.exists(post.path))},getFileProperties:function(get,post){return _packet(cache.file.getFileProperties(post.path))},open:function(get,post){var msg="Attempting to open file: "+post.path;notifications.openNotification("normal",msg);return _packet(cache.file.exists(post.path))},readFile:function(get,post,baton){var val;if(post.async){baton.take()}cache.file.readFile(post.path,function(data){if(post.async){baton.pass(_packet({fullPath:post.path,blobData:data}))}else{val=data}},post.async);if(!post.async){return _packet({fullPath:post.path,blobData:val})}},rename:function(get,post){cache.file.rename(post.path,post.newName);return _packet()},saveFile:function(get,post){cache.file.saveFile(post.path,post.blob);return _packet()}}});ripple.define("platform/webworks.core/2.0.0/server/system",function(ripple,exports,module){var deviceSettings=ripple("deviceSettings"),devices=ripple("devices"),app=ripple("app"),client=ripple("platform/webworks.core/2.0.0/client/system"),utils=ripple("utils"),notifications=ripple("notifications"),platform=ripple("platform"),_self;function _is(feature){return{allowedFor:function(location){return feature&&feature.URIs.some(function(uri){return uri.value===location||location.indexOf(uri.value)>=0&&uri.subdomains})}}}_self={hasCapability:function(args){var capabilities=devices.getCurrentDevice().capabilities;return{code:1,data:capabilities?capabilities.some(function(type){return type===args.capability}):false}},isMassStorageActive:function(){return{code:1,data:deviceSettings.retrieveAsBoolean("system.isMassStorageActive")}},hasDataCoverage:function(){return{code:1,data:deviceSettings.retrieveAsBoolean("system.hasDataCoverage")}},softwareVersion:function(){return{code:1,data:devices.getCurrentDevice().osVersion}},model:function(){return{code:1,data:devices.getCurrentDevice().model}},scriptApiVersion:function(){return{code:1,data:platform.current().version}},setHomeScreenBackground:function(args){var path=args.filePath,msg="Set home screen background to "+path+".";notifications.openNotification("normal",msg);return{code:1}},hasPermission:function(args){var info=app.getInfo(),feature=info.features?info.features[args.desiredModule]:null;return{code:1,data:feature===null||_is(feature).allowedFor(utils.location().href)?client.ALLOW:client.DENY}},network:function(){return{code:1,data:deviceSettings.retrieve("system.network")}}};module.exports=_self});ripple.define("platform/webworks.core/2.0.0/spec/config",function(ripple,exports,module){var utils=ripple("utils");module.exports={fileName:"config.xml",validateVersion:function(){return true},extractInfo:function(config){if(!config){return null}var widgetInfo={},widgetFeatures=config.widget.children.feature.validationResult,accessUrls=config.widget.children.access.validationResult,accessFeatures=config.widget.children.access.children.feature.validationResult,toFeature=function(validationResult){return{id:validationResult.attributes.id.value,required:!validationResult.attributes.required||validationResult.attributes.required.value,URIs:[]}};widgetInfo.id=config.widget.validationResult[0].attributes.id.value;widgetInfo.name=config.widget.children.name.validationResult[0].value;widgetInfo.icon=config.widget.children.icon.validationResult[0].attributes.src.value;widgetInfo.version=config.widget.validationResult[0].attributes.version.value;widgetInfo.author=config.widget.children.author.validationResult[0].value;widgetInfo.authorEmail=config.widget.children.author.validationResult[0].attributes.email.value;widgetInfo.authorURL=config.widget.children.author.validationResult[0].attributes.href.value;widgetInfo.copyright=config.widget.children.author.validationResult[0].attributes["rim:copyright"].value;widgetInfo.description=config.widget.children.description.validationResult[0].value;if(config.widget.children.license.validationResult[0]){widgetInfo.license=config.widget.children.license.validationResult[0].value;widgetInfo.licenseURL=config.widget.children.license.validationResult[0].attributes.href.value}widgetInfo.features=widgetFeatures.reduce(function(features,validationResult){if(validationResult.valid){var feature=toFeature(validationResult);feature.URIs.push({value:utils.location().href,subdomains:true});features=features||{};features[feature.id]=feature}return features},{});widgetInfo.features=accessUrls.map(function(access){return{uri:access.attributes.uri.value,subdomains:access.attributes.subdomains.value,features:accessFeatures?accessFeatures.filter(function(f){return f.node&&f.node.parentNode&&f.node.parentNode.attributes.uri.value===access.attributes.uri.value}):null}}).reduce(function(result,access){return access.features?access.features.reduce(function(features,validationResult){var feature=features[validationResult.attributes.id.value]||toFeature(validationResult);feature.URIs.push({value:access.uri,subdomains:access.subdomains});features[feature.id]=feature;return features},result):result},widgetInfo.features);return widgetInfo},schema:{rootElement:"widget",widget:{nodeName:"widget",required:true,occurrence:1,attributes:{xmlns:{attributeName:"xmlns",required:true,type:"list",listValues:["http://www.w3.org/ns/widgets"]},"xmlns:rim":{attributeName:"xmlns:rim",required:true,type:"list",listValues:["http://www.blackberry.com/ns/widgets"]},"xml:lang":{attributeName:"xml:lang",required:false,type:"iso-language"},id:{attributeName:"id",required:false,type:"string"},version:{attributeName:"version",required:false,type:"string"},"rim:header":{attributeName:"rim:header",required:false,type:"string"},"rim:backButton":{attributeName:"rim:backButton",required:false,type:"string"}},children:{name:{nodeName:"name",required:true,occurrence:1,attributes:{"xml:lang":{attributeName:"xml:lang",required:false,type:"iso-language"},"its:dir":{attributeName:"its:dir",required:false,type:"list",listValues:["rtl","ltr","lro","rlo"]}}},description:{nodeName:"description",required:false,occurrence:1,attributes:{"xml:lang":{attributeName:"xml:lang",required:false,type:"iso-language"},"its:dir":{attributeName:"its:dir",required:false,type:"list",listValues:["rtl","ltr","lro","rlo"]}}},icon:{nodeName:"icon",required:false,occurrence:0,attributes:{src:{attributeName:"src",type:"string",required:true},"rim:hover":{attributeName:"rim:hover",type:"boolean",required:false}}},author:{nodeName:"author",required:false,occurrence:1,attributes:{href:{attributeName:"href",type:"string",required:false},"rim:copyright":{attributeName:"rim:copyright",type:"string",required:false},email:{attributeName:"email",type:"string",required:false},"xml:lang":{attributeName:"xml:lang",required:false,type:"iso-language"},"its:dir":{attributeName:"its:dir",required:false,type:"list",listValues:["rtl","ltr","lro","rlo"]}}},license:{nodeName:"license",required:false,occurrence:1,attributes:{href:{attributeName:"href",type:"string",required:false},"xml:lang":{attributeName:"xml:lang",required:false,type:"iso-language"},"its:dir":{attributeName:"its:dir",required:false,type:"list",listValues:["rtl","ltr","lro","rlo"]}}},"rim:cache":{nodeName:"rim:cache",required:false,occurrence:1,attributes:{disableAllCache:{attributeName:"disableAllCache",required:false,type:"boolean"},aggressiveCacheAge:{attributeName:"aggressiveCacheAge",required:false,type:"number"},maxCacheSizeTotal:{attributeName:"maxCacheSizeTotal",required:false,type:"number"},maxCacheSizeItem:{attributeName:"maxCacheSizeItem",required:false,type:"number"}}},access:{nodeName:"access",required:false,occurrence:0,attributes:{uri:{attributeName:"uri",required:true,type:"string"},subdomains:{attributeName:"subdomains",required:false,type:"boolean"}},children:{feature:{nodeName:"feature",required:false,occurrence:0,attributes:{id:{attributeName:"id",required:true,type:"string"},required:{attributeName:"required",required:false,type:"boolean"},version:{attributeName:"version",required:false,type:"string"}}}}},feature:{nodeName:"feature",required:false,occurrence:0,attributes:{id:{attributeName:"id",required:true,type:"string"},required:{attributeName:"required",required:false,type:"boolean"},version:{attributeName:"version",required:false,type:"string"}}},"rim:loadingScreen":{nodeName:"rim:loadingScreen",required:false,occurrence:1,attributes:{backgroundColor:{attributeName:"backgroundColor",required:false,type:"string"},backgroundImage:{attributeName:"backgroundImage",required:false,type:"string"},foregroundImage:{attributeName:"foregroundImage",required:false,type:"string"},onRemotePageLoad:{attributeName:"onRemotePageLoad",required:false,type:"boolean"},onLocalPageLoad:{attributeName:"onLocalPageLoad",required:false,type:"boolean"},onFirstLaunch:{attributeName:"onFirstLaunch",required:false,type:"boolean"}},children:{"rim:transitionEffect":{nodeName:"rim:transitionEffect",required:false,occurrence:1,attributes:{type:{attributeName:"type",required:true,type:"list",listValues:["slidePush","slideOver","fadeIn","fadeOut","wipeIn","wipeOut","zoomIn","zoomOut"]},duration:{attributeName:"duration",required:false,type:"number"},direction:{attributeName:"direction",required:false,type:"list",listValues:["left","right","up","down"]}}}}},"rim:connection":{nodeName:"rim:connection",required:false,occurrence:1,attributes:{timeout:{attributeName:"timeout",required:false,type:"number"}},children:{id:{nodeName:"id",required:false,occurrence:0}}},"rim:navigation":{nodeName:"rim:navigation",required:false,occurrence:1,attributes:{mode:{attributeName:"mode",required:false,type:"list",listValues:["focus"]}}},content:{nodeName:"content",required:true,occurrence:1,attributes:{src:{attributeName:"src",required:true,type:"string"},type:{attributeName:"type",required:false,type:"string"},charset:{attributeName:"charset",required:false,type:"string"}}}}}}}});ripple.define("platform/webworks.core/2.0.0/spec/events",function(ripple,exports,module){var event=ripple("event");module.exports={"app.event.onBackground":{callback:function(){event.trigger("AppRequestBackground")}},"app.event.onForeground":{callback:function(){event.trigger("AppRequestForeground")}}}});ripple.define("platform/webworks.handset/2.0.0/XMLHttpRequest",function(ripple,exports,module){var xhr=ripple("platform/webworks.core/2.0.0/XMLHttpRequest");module.exports=xhr.create("platform/webworks.handset/2.0.0/server")});ripple.define("platform/webworks.handset/2.0.0/client/Address",function(ripple,exports,module){function Address(){return{address1:null,address2:null,city:null,country:null,stateProvince:null,zipPostal:null}}module.exports=Address});ripple.define("platform/webworks.handset/2.0.0/client/AddressBookArguments",function(ripple,exports,module){var _self=function(contact){return{contact:contact,view:0}};_self.__defineGetter__("VIEW_NEW",function(){return 0});_self.__defineGetter__("VIEW_COMPOSE",function(){return 1});_self.__defineGetter__("VIEW_DISPLAY",function(){return 2});module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/Appointment",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_uri="blackberry/pim/appointment/";function Appointment(){var _self={allDay:false,attendees:[],end:null,freeBusy:null,location:null,note:null,recurrence:null,reminder:null,start:null,summary:null,uid:null,remove:function(){transport.call(_uri+"remove",{get:{uid:_self.uid}})},save:function(){if(_self.uid===null){_self.uid=Number(Math.uuid(8,10))}transport.call(_uri+"save",{post:{appointment:_self}})}};return _self}function _massage(property,name){if(name==="recurrence"&&property){if(property.end){property.end=new Date(property.end)}}if(name==="reminder"&&property){if(property.date){property.date=new Date(property.date)}}if((name==="end"||name==="start")&&property){property=new Date(property)}return property}Appointment.find=function(filter,orderBy,maxReturn,service,isAscending){var opts={post:{filter:filter,orderBy:orderBy,maxReturn:maxReturn,service:service,isAscending:isAscending}};return transport.call(_uri+"find",opts).map(function(obj){var appt=new Appointment;appt.allDay=obj.allDay;appt.attendees=obj.attendees;appt.end=_massage(obj.end,"end");appt.freeBusy=obj.freeBusy;appt.location=obj.location;appt.note=obj.note;appt.recurrence=_massage(obj.recurrence,"recurrence");appt.reminder=_massage(obj.reminder,"reminder");appt.start=_massage(obj.start,"start");appt.summary=obj.summary;appt.uid=obj.uid;return appt})};Appointment.__defineGetter__("FREE",function(){return 0});Appointment.__defineGetter__("TENTATIVE",function(){return 1});Appointment.__defineGetter__("BUSY",function(){return 2});Appointment.__defineGetter__("OUT_OF_OFFICE",function(){return 3});module.exports=Appointment});ripple.define("platform/webworks.handset/2.0.0/client/Attendee",function(ripple,exports,module){function Attendee(){return{address:null,type:null}}Attendee.__defineGetter__("ORGANIZER",function(){return 0});Attendee.__defineGetter__("INVITED",function(){return 1});Attendee.__defineGetter__("ACCEPTED",function(){return 2});Attendee.__defineGetter__("DECLINED",function(){return 3});Attendee.__defineGetter__("TENTATIVE",function(){return 4});module.exports=Attendee});ripple.define("platform/webworks.handset/2.0.0/client/AudioPlayer",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_uri="blackberry/audio/player/";function Player(locator,type){var _id=transport.call(_uri+"create",{get:{locator:locator,type:type},async:false}),_listener,_closed,_self,_poll=function(path){transport.poll(_uri+path,{get:{id:_id}},function(response){if(_listener){_listener(_self,response.event,response.eventData)}return!!_listener})};_self={addPlayerListener:function(callback){if(!_closed&&callback){_listener=callback;_poll("onStart");_poll("onStopped");_poll("onBufferingStarted");_poll("onBufferingStopped");_poll("onDurationUpdated");_poll("onEnd");_poll("onError");_poll("onVolumeChange");_poll("onClose")}else{_listener=null}return!_closed},close:function(){_listener=null;_closed=true;return transport.call(_uri+"close",{get:{id:_id}})},pause:function(){return transport.call(_uri+"pause",{get:{id:_id}})},play:function(){return transport.call(_uri+"play",{get:{id:_id}})}};_self.__defineGetter__("duration",function(){return transport.call(_uri+"getDuration",{get:{id:_id}})});_self.__defineGetter__("mediaTime",function(){return transport.call(_uri+"getMediaTime",{get:{id:_id}})});_self.__defineSetter__("mediaTime",function(val){transport.call(_uri+"setMediaTime",{get:{id:_id,value:val}})});_self.__defineGetter__("state",function(){return transport.call(_uri+"getState",{get:{id:_id}})});_self.__defineGetter__("volumeLevel",function(){return transport.call(_uri+"getVolumeLevel",{get:{id:_id}})});_self.__defineSetter__("volumeLevel",function(val){transport.call(_uri+"setVolumeLevel",{get:{id:_id,value:val}})});_self.__defineGetter__("EVENT_BUFFERING_STARTED",function(){return"EVENT_BUFFERING_STARTED"});_self.__defineGetter__("EVENT_BUFFERING_STOPPED",function(){return"EVENT_BUFFERING_STOPPED"});_self.__defineGetter__("EVENT_CLOSED",function(){return"EVENT_CLOSED"});_self.__defineGetter__("EVENT_DEVICE_AVAILABLE",function(){return"EVENT_DEVICE_AVAILABLE"});_self.__defineGetter__("EVENT_DEVICE_UNAVAILABLE",function(){return"EVENT_DEVICE_UNAVAILABLE"});_self.__defineGetter__("EVENT_DURATION_UPDATED",function(){return"EVENT_DURATION_UPDATED"});_self.__defineGetter__("EVENT_END_OF_MEDIA",function(){return"EVENT_END_OF_MEDIA"});_self.__defineGetter__("EVENT_ERROR",function(){return"EVENT_ERROR"});_self.__defineGetter__("EVENT_RECORD_ERROR",function(){return"EVENT_ERROR"});_self.__defineGetter__("EVENT_RECORD_STARTED",function(){return"EVENT_RECORD_STARTED"});_self.__defineGetter__("EVENT_RECORD_STOPPED",function(){return"EVENT_RECORD_STOPPED"});_self.__defineGetter__("EVENT_SIZE_CHANGED",function(){return"EVENT_SIZE_CHANGED"});_self.__defineGetter__("EVENT_STARTED",function(){return"EVENT_STARTED"});_self.__defineGetter__("EVENT_STOPPED",function(){return"EVENT_STOPPED"});_self.__defineGetter__("EVENT_STOPPED_AT_TIME",function(){return"EVENT_STOPPED_AT_TIME"});_self.__defineGetter__("EVENT_VOLUME_CHANGED",function(){return"EVENT_VOLUME_CHANGED"});return _self}Player.__defineGetter__("TIME_UNKNOWN",function(){return-1});Player.__defineGetter__("CLOSED",function(){return 0});Player.__defineGetter__("UNREALIZED",function(){return 100});Player.__defineGetter__("REALIZED",function(){return 200});Player.__defineGetter__("PREFETCHED",function(){return 300});Player.__defineGetter__("STARTED",function(){return 400});module.exports=Player});ripple.define("platform/webworks.handset/2.0.0/client/BrowserArguments",function(ripple,exports,module){module.exports=function(url){return{url:url}}});ripple.define("platform/webworks.handset/2.0.0/client/CalendarArguments",function(ripple,exports,module){var _self=function(){return{appointment:undefined,date:undefined,view:0}};_self.__defineGetter__("VIEW_NEW",function(){return 0});_self.__defineGetter__("VIEW_VIEW",function(){return 1});_self.__defineGetter__("VIEW_AGENDA",function(){return 2});_self.__defineGetter__("VIEW_DAY",function(){return 3});_self.__defineGetter__("VIEW_DEFAULT",function(){return 4});_self.__defineGetter__("VIEW_MONTH",function(){return 5});_self.__defineGetter__("VIEW_WEEK",function(){return 6});module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/CallLog",function(ripple,exports,module){function CallLog(){this.addressBookNumber=null;this.addressBookType=null;this.date=null;this.duration=null;this.name=null;this.notes=null;this.number=null;this.status=null;this.type=null}function _get(val){return function(){return val}}CallLog.__defineGetter__("STATUS_NORMAL",_get(0));CallLog.__defineGetter__("STATUS_BUSY",_get(1));CallLog.__defineGetter__("STATUS_CONGESTION",_get(2));CallLog.__defineGetter__("STATUS_PATH_UNAVAILABLE",_get(3));CallLog.__defineGetter__("STATUS_NUMBER_UNOBTAINABLE",_get(4));CallLog.__defineGetter__("STATUS_AUTHENTICATION_FAILURE",_get(5));CallLog.__defineGetter__("STATUS_EMERGENCY_CALLS_ONLY",_get(6));CallLog.__defineGetter__("STATUS_HOLD_ERROR",_get(7));CallLog.__defineGetter__("STATUS_OUTGOING_CALLS_BARRED",_get(8));CallLog.__defineGetter__("STATUS_GENERAL_ERROR",_get(9));CallLog.__defineGetter__("STATUS_MAINTENANCE_REQUIRED",_get(10));CallLog.__defineGetter__("STATUS_SERVICE_NOT_AVAILABLE",_get(11));CallLog.__defineGetter__("STATUS_CALL_FAIL_DUE_TO_FADING",_get(12));CallLog.__defineGetter__("STATUS_CALL_LOST_DUE_TO_FADING",_get(13));CallLog.__defineGetter__("STATUS_CALL_FAILED_TRY_AGAIN",_get(14));CallLog.__defineGetter__("STATUS_FDN_MISMATCH",_get(15));CallLog.__defineGetter__("STATUS_CONNECTION_DENIED",_get(16));CallLog.__defineGetter__("STATUS_INCOMING_CALL_BARRED",_get(17));CallLog.__defineGetter__("TYPE_RECEIVED_CALL",_get(0));CallLog.__defineGetter__("TYPE_PLACED_CALL",_get(1));CallLog.__defineGetter__("TYPE_MISSED_CALL_UNOPENED",_get(2));CallLog.__defineGetter__("TYPE_MISSED_CALL_OPENED",_get(3));module.exports=CallLog});ripple.define("platform/webworks.handset/2.0.0/client/CameraArguments",function(ripple,exports,module){var _self=function(){return{view:0}};_self.__defineGetter__("VIEW_CAMERA",function(){return 0});_self.__defineGetter__("VIEW_RECORDER",function(){return 1});module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/Contact",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_uri="blackberry/pim/contact/";function Contact(){var _self={anniversary:null,birthday:null,categories:[],company:null,email1:"",email2:"",email3:"",faxPhone:null,firstName:null,homeAddress:null,homePhone:null,homePhone2:null,jobTitle:null,lastName:null,mobilePhone:null,note:null,otherPhone:null,pagerPhone:null,picture:null,pin:null,title:null,uid:null,user1:null,user2:null,user3:null,user4:null,webpage:null,workAddress:null,workPhone:null,workPhone2:null,remove:function(){if(!_self.uid){throw"task has not yet been saved (has no uid)"}transport.call(_uri+"remove",{get:{id:_self.uid}})},save:function(){if(!_self.uid){_self.uid=Math.uuid(null,16)}transport.call(_uri+"save",{post:{contact:_self}})},setPicture:function(){throw"not implemented"}};return _self}function _massage(property,name){if((name==="anniversary"||name==="birthday")&&property){return new Date(property)}return property}Contact.find=function(fieldFilter,orderBy,maxReturn,service,isAscending){return transport.call(_uri+"find",{post:{fieldFilter:fieldFilter,orderBy:orderBy,maxReturn:maxReturn,service:service,isAscending:isAscending}}).map(function(properties){var contact=new Contact,key;for(key in properties){if(contact.hasOwnProperty(key)){contact[key]=_massage(properties[key],key)}}return contact})};module.exports=Contact});ripple.define("platform/webworks.handset/2.0.0/client/FilterExpression",function(ripple,exports,module){var FilterExpression=function(leftField,operator,rightField,negate){this.__defineGetter__("leftField",function(){return leftField});this.__defineGetter__("operator",function(){return operator});this.__defineGetter__("rightField",function(){return rightField});this.__defineGetter__("negate",function(){return negate?true:false})};module.exports=FilterExpression});ripple.define("platform/webworks.handset/2.0.0/client/JavaArguments",function(ripple,exports,module){var _self=function(uri,params){return{uri:uri,params:params,args:arguments}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/MapsArguments",function(ripple,exports,module){var _self=function(){return{}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/Memo",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_uri="blackberry/pim/memo/";function Memo(){var _self={categories:[],note:null,title:null,uid:null,remove:function(){transport.call(_uri+"remove",{get:{uid:_self.uid}})},save:function(){if(_self.uid===null){_self.uid=Number(Math.uuid(8,10))}transport.call(_uri+"save",{post:{memo:_self}})}};return _self}Memo.find=function(filter,orderBy,maxReturn,service,isAscending){var opts={post:{filter:filter,orderBy:orderBy,maxReturn:maxReturn,isAscending:isAscending,service:service}};return transport.call(_uri+"find",opts).map(function(obj){var memo=new Memo;memo.uid=obj.uid;memo.categories=obj.categories||[];memo.note=obj.note;memo.title=obj.title;return memo})};module.exports=Memo});ripple.define("platform/webworks.handset/2.0.0/client/MemoArguments",function(ripple,exports,module){var _self=function(memo){return{memo:memo,view:0}};_self.__defineGetter__("VIEW_NEW",function(){return 0});_self.__defineGetter__("VIEW_EDIT",function(){return 1});module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/MenuItem",function(ripple,exports,module){var event=ripple("event");function MenuItem(isSeparator,ordinal,caption,callback){var _isDefault=false,id=Math.uuid();if(ordinal<0){throw"Ordinal cannot be less than 0"}else if(isSeparator){if(caption!==undefined){throw"caption must not be supplied"}else if(callback!==undefined){throw"callback must not be supplied"}}else if(!isSeparator){if(caption===undefined){throw"caption must be supplied"}}this.callback=callback;this.__defineSetter__("id",function(i){id=i});this.__defineGetter__("id",function(){return id});this.__defineSetter__("caption",function(c){caption=c;event.trigger("MenuItemChanged",[this])});this.__defineGetter__("caption",function(){return caption});this.__defineSetter__("ordinal",function(o){ordinal=o;event.trigger("MenuItemChanged",[this])});this.__defineGetter__("ordinal",function(){return ordinal});this.__defineGetter__("isSeparator",function(){return isSeparator});this.__defineSetter__("isDefault",function(d){_isDefault=d;event.trigger("MenuItemChanged",[this])});this.__defineGetter__("isDefault",function(){return _isDefault});this.__defineGetter__("id",function(){return id})}module.exports=MenuItem});ripple.define("platform/webworks.handset/2.0.0/client/Message",function(ripple,exports,module){var identity=ripple("platform/webworks.handset/2.0.0/client/identity"),transport=ripple("platform/webworks.core/2.0.0/client/transport"),Service=ripple("platform/webworks.handset/2.0.0/client/identity/Service"),_uri="blackberry/message/message/";function Message(service){var _service=service,_msg={uid:0,status:Message.STATUS_DRAFT,from:"",folder:Message.FOLDER_DRAFT,replyTo:"",bccRecipients:"",body:"",ccRecipients:"",priority:Message.PRIORITY_MEDIUM,subject:"",toRecipients:"",
remove:function(){_msg.folder=Message.FOLDER_DELETED;transport.call(_uri+"remove",{get:{uid:_msg.uid}})},save:function(){if(_msg.uid===0){_msg.uid=Number(Math.uuid(8,10))}_msg.replyTo=_msg.from=_service.emailAddress;_msg.status=Message.STATUS_SAVED;transport.call(_uri+"save",{post:{message:_msg}})},send:function(){if(_msg.toRecipients){if(_msg.uid===0){_msg.uid=Number(Math.uuid(8,10))}_msg.folder=Message.FOLDER_DRAFT;_msg.status=Message.STATUS_UNKNOWN;transport.call(_uri+"send",{get:{message:_msg}})}else{throw"message has no recipients"}}};if(!_service){_service=identity.getDefaultService().reduce(function(email,service){return service.type===Service.TYPE_EMAIL?service:email},null)}return _msg}Message.find=function(filter,maxReturn,service){var opts={post:{filter:filter,maxReturn:maxReturn,service:service}};return transport.call(_uri+"find",opts).map(function(obj){var msg=new Message;msg.uid=obj.uid;msg.status=obj.status;msg.from=obj.from;msg.folder=obj.folder;msg.replyTo=obj.replyTo;msg.bccRecipients=obj.bccRecipients;msg.body=obj.body;msg.ccRecipients=obj.ccRecipients;msg.priority=obj.priority;msg.subject=obj.subject;msg.toRecipients=obj.toRecipients;return msg})};Message.__defineGetter__("STATUS_UNKNOWN",function(){return-1});Message.__defineGetter__("STATUS_SAVED",function(){return 0});Message.__defineGetter__("STATUS_DRAFT",function(){return 1});Message.__defineGetter__("STATUS_SENT",function(){return 2});Message.__defineGetter__("STATUS_ERROR_OCCURED",function(){return 3});Message.__defineGetter__("PRIORITY_HIGH",function(){return 0});Message.__defineGetter__("PRIORITY_MEDIUM",function(){return 1});Message.__defineGetter__("PRIORITY_LOW",function(){return 2});Message.__defineGetter__("FOLDER_INBOX",function(){return 0});Message.__defineGetter__("FOLDER_SENT",function(){return 1});Message.__defineGetter__("FOLDER_DRAFT",function(){return 2});Message.__defineGetter__("FOLDER_OUTBOX",function(){return 3});Message.__defineGetter__("FOLDER_DELETED",function(){return 4});Message.__defineGetter__("FOLDER_OTHER",function(){return 5});module.exports=Message});ripple.define("platform/webworks.handset/2.0.0/client/MessageArguments",function(ripple,exports,module){var _self=function(){return{view:1}};_self.__defineGetter__("VIEW_NEW",function(){return 0});_self.__defineGetter__("VIEW_DEFAULT",function(){return 1});_self.__defineGetter__("VIEW_SAVED",function(){return 2});_self.__defineGetter__("VIEW_SEARCH",function(){return 3});module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/Phone",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_uri="blackberry/phone/",_listeners={},_self;_self={activeCalls:function(){return transport.call(_uri+"activeCalls")},addPhoneListener:function(callback,eventType){var assigned=false;if(callback&&typeof eventType==="number"){_listeners[eventType]=callback;assigned=true}else if(eventType&&callback===null){delete _listeners[eventType]}else{_listeners={}}transport.poll(_uri+"onPhoneEvent",{get:{eventType:eventType}},function(response){var func=_listeners[eventType];if(func){func(response.callId,response.error)}return!!func});return assigned},inActiveCall:function(){return transport.call(_uri+"inActiveCall")}};_self.__defineGetter__("CB_CALL_INITIATED",function(){return 0});_self.__defineGetter__("CB_CALL_WAITING",function(){return 1});_self.__defineGetter__("CB_CALL_INCOMING",function(){return 2});_self.__defineGetter__("CB_CALL_ANSWERED",function(){return 3});_self.__defineGetter__("CB_CALL_CONNECTED",function(){return 4});_self.__defineGetter__("CB_CALL_CONFERENCECALL_ESTABLISHED",function(){return 5});_self.__defineGetter__("CB_CONFERENCECALL_DISCONNECTED",function(){return 6});_self.__defineGetter__("CB_CALL_DISCONNECTED",function(){return 7});_self.__defineGetter__("CB_CALL_DIRECTCONNECT_CONNECTED",function(){return 8});_self.__defineGetter__("CB_CALL_DIRECTCONNECT_DISCONNECTED",function(){return 9});_self.__defineGetter__("CB_CALL_ENDED_BYUSER",function(){return 10});_self.__defineGetter__("CB_CALL_FAILED",function(){return 11});_self.__defineGetter__("CB_CALL_RESUMED",function(){return 12});_self.__defineGetter__("CB_CALL_HELD",function(){return 13});_self.__defineGetter__("CB_CALL_ADDED",function(){return 14});_self.__defineGetter__("CB_CALL_REMOVED",function(){return 15});_self.__defineGetter__("CALL_ERROR_SUBSCRIBER_BUSY",function(){return 1});_self.__defineGetter__("CALL_ERROR_CONGESTION",function(){return 2});_self.__defineGetter__("CALL_ERROR_RADIO_PATH_UNAVAILABLE",function(){return 3});_self.__defineGetter__("CALL_ERROR_NUMBER_UNOBTAINABLE",function(){return 4});_self.__defineGetter__("CALL_ERROR_AUTHORIZATION_FAILURE",function(){return 5});_self.__defineGetter__("CALL_ERROR_EMERGENCY_CALLS_ONLY",function(){return 6});_self.__defineGetter__("CALL_ERROR_HOLD_ERROR",function(){return 7});_self.__defineGetter__("CALL_ERROR_OUTGOING_CALLS_BARRED",function(){return 8});_self.__defineGetter__("CALL_ERROR_GENERAL",function(){return 9});_self.__defineGetter__("CALL_ERROR_MAINTENANCE_REQUIRED",function(){return 10});_self.__defineGetter__("CALL_ERROR_SERVICE_NOT_AVAILABLE",function(){return 11});_self.__defineGetter__("CALL_ERROR_DUE_TO_FADING",function(){return 12});_self.__defineGetter__("CALL_ERROR_LOST_DUE_TO_FADING",function(){return 13});_self.__defineGetter__("CALL_ERROR_TRY_AGAIN",function(){return 14});_self.__defineGetter__("CALL_ERROR_FDN_MISMATCH",function(){return 15});_self.__defineGetter__("CALL_ERROR_CONNECTION_DENIED_BY_NETWORK",function(){return 16});_self.__defineGetter__("CALL_ERROR_NUMBER_NOT_IN_SERVICE",function(){return 17});_self.__defineGetter__("CALL_ERROR_PLEASE_TRY_LATER",function(){return 18});_self.__defineGetter__("CALL_ERROR_SERVICE_CONFLICT",function(){return 19});_self.__defineGetter__("CALL_ERROR_SYSTEM_BUSY_TRY_LATER",function(){return 20});_self.__defineGetter__("CALL_ERROR_USER_BUSY_IN_PRIVATE",function(){return 21});_self.__defineGetter__("CALL_ERROR_USER_BUSY_IN_DATA",function(){return 22});_self.__defineGetter__("CALL_ERROR_USER_NOT_AUTHORIZED",function(){return 23});_self.__defineGetter__("CALL_ERROR_USER_NOT_AVAILABLE",function(){return 24});_self.__defineGetter__("CALL_ERROR_USER_UNKNOWN",function(){return 25});_self.__defineGetter__("CALL_ERROR_USER_NOT_REACHABLE",function(){return 26});_self.__defineGetter__("CALL_ERROR_INCOMING_CALL_BARRED",function(){return 27});_self.__defineGetter__("CALL_ERROR_CALL_REPLACED_BY_STK",function(){return 28});_self.__defineGetter__("CALL_ERROR_STK_CALL_NOT_ALLOWED",function(){return 29});module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/PhoneArguments",function(ripple,exports,module){var _self=function(dialString,smartDialing,lineId){return{dialString:dialString,smartDialing:smartDialing,lineId:lineId?lineId:-1,view:0}};_self.__defineGetter__("VIEW_CALL",function(){return 0});_self.__defineGetter__("VIEW_VOICEMAIL",function(){return 1});module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/PhoneCall",function(ripple,exports,module){function PhoneCall(onhold){return{outgoing:false,recipientName:null,recipientNumber:null,isOnHold:function(){return onhold}}}module.exports=PhoneCall});ripple.define("platform/webworks.handset/2.0.0/client/PhoneLogs",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),CallLog=ripple("platform/webworks.handset/2.0.0/client/CallLog"),utils=ripple("utils"),_onCallLog={Added:null,Removed:null,Updated:null,Reset:null},_uri="blackberry/phone/logs/",_self;function _massage(property,name){if(name==="date"&&property){return new Date(property)}return property}function _toCallLog(log){var callLog=new CallLog,prop;for(prop in log){if(log.hasOwnProperty(prop)){callLog[prop]=_massage(log[prop],prop)}}return callLog}function handle(evt){return function(response){var func=_onCallLog[evt],args;if(func){args=utils.map(response,function(value){return _toCallLog(value)});func.apply(null,args)}return!!func}}function poll(path){transport.poll(_uri+path,{},handle(path.replace("onCallLog","")))}_self={addPhoneLogListener:function(onCallLogAdded,onCallLogRemoved,onCallLogUpdated,onCallLogReset){_onCallLog.Added=onCallLogAdded;_onCallLog.Removed=onCallLogRemoved;_onCallLog.Updated=onCallLogUpdated;_onCallLog.Reset=onCallLogReset;if(onCallLogAdded){poll("onCallLogAdded")}if(onCallLogRemoved){poll("onCallLogRemoved")}if(onCallLogUpdated){poll("onCallLogUpdated")}if(onCallLogReset){poll("onCallLogReset")}return!!(onCallLogAdded||onCallLogRemoved||onCallLogUpdated||onCallLogRemoved)},callAt:function(index,folderID){var log=transport.call(_uri+"callAt",{get:{index:index,folderID:folderID}});if(log&&log.date){log.date=new Date(log.date)}return log},deleteCallAt:function(index,folderID){return transport.call(_uri+"deleteCallAt",{get:{index:index,folderID:folderID}})},find:function(filter,folderID,orderBy,maxReturn,isAscending){return transport.call(_uri+"find",{post:{filter:filter,folderID:folderID,orderBy:orderBy,maxReturn:maxReturn,isAscending:isAscending}}).map(_toCallLog)},numberOfCalls:function(folderID){return transport.call(_uri+"numberOfCalls",{get:{folderID:folderID}})}};_self.__defineGetter__("FOLDER_MISSED_CALLS",function(){return 0});_self.__defineGetter__("FOLDER_NORMAL_CALLS",function(){return 1});module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/PushData",function(ripple,exports,module){function PushData(data,port){this.port=port;this.data=data;this.getHeaderField=function(field){if(field===undefined||field===null){throw"no field specified"}else if(!(typeof field==="number"&&field>=0)&&typeof field!=="string"){throw"field is not valid"}return data.headerField[field]};this.getRequestURI=function(){return data.requestURI};this.getSource=function(){return data.source};this.isChannelEncrypted=data.isChannelEncrypted;this.payload=data.payload;this.__defineGetter__("ACCEPT",function(){return 0});this.__defineGetter__("DECLINE_USERDCR",function(){return 1});this.__defineGetter__("DECLINE_USERDCU",function(){return 2});this.__defineGetter__("DECLINE_USERPND",function(){return 3});this.__defineGetter__("DECLINE_USERREQ",function(){return 4});this.__defineGetter__("DECLINE_USERRFS",function(){return 5})}module.exports=PushData});ripple.define("platform/webworks.handset/2.0.0/client/Recurrence",function(ripple,exports,module){function Recurrence(){return{count:null,dayInMonth:null,dayInWeek:null,dayInYear:null,end:null,frequency:null,interval:null,monthInYear:null,weekInMonth:null}}Recurrence.__defineGetter__("NO_REPEAT",function(){return 0});Recurrence.__defineGetter__("DAILY",function(){return 1});Recurrence.__defineGetter__("WEEKLY",function(){return 2});Recurrence.__defineGetter__("MONTHLY",function(){return 3});Recurrence.__defineGetter__("YEARLY",function(){return 4});Recurrence.__defineGetter__("JANUARY",function(){return 131072});Recurrence.__defineGetter__("FEBRUARY",function(){return 262144});Recurrence.__defineGetter__("MARCH",function(){return 524288});Recurrence.__defineGetter__("APRIL",function(){return 1048576});Recurrence.__defineGetter__("MAY",function(){return 2097152});Recurrence.__defineGetter__("JUNE",function(){return 4194304});Recurrence.__defineGetter__("JULY",function(){return 8388608});Recurrence.__defineGetter__("AUGUST",function(){return 16777216});Recurrence.__defineGetter__("SEPTEMBER",function(){return 33554432});Recurrence.__defineGetter__("OCTOBER",function(){return 67108864});Recurrence.__defineGetter__("NOVEMBER",function(){return 134217728});Recurrence.__defineGetter__("DECEMBER",function(){return 268435456});Recurrence.__defineGetter__("FIRST",function(){return 1});Recurrence.__defineGetter__("SECOND",function(){return 2});Recurrence.__defineGetter__("THIRD",function(){return 4});Recurrence.__defineGetter__("FOURTH",function(){return 8});Recurrence.__defineGetter__("FIFTH",function(){return 16});Recurrence.__defineGetter__("LAST",function(){return 32});Recurrence.__defineGetter__("SECONDLAST",function(){return 64});Recurrence.__defineGetter__("THIRDLAST",function(){return 128});Recurrence.__defineGetter__("FOURTHLAST",function(){return 256});Recurrence.__defineGetter__("FIFTHLAST",function(){return 512});Recurrence.__defineGetter__("SUNDAY",function(){return 65536});Recurrence.__defineGetter__("MONDAY",function(){return 32768});Recurrence.__defineGetter__("TUESDAY",function(){return 16384});Recurrence.__defineGetter__("WEDNESDAY",function(){return 8192});Recurrence.__defineGetter__("THURSDAY",function(){return 4096});Recurrence.__defineGetter__("FRIDAY",function(){return 2048});Recurrence.__defineGetter__("SATURDAY",function(){return 1024});module.exports=Recurrence});ripple.define("platform/webworks.handset/2.0.0/client/Reminder",function(ripple,exports,module){var Reminder=function(){return{date:null,relativeHours:null,type:null}};Reminder.__defineGetter__("DATE",function(){return 0});Reminder.__defineGetter__("RELATIVE",function(){return 1});module.exports=Reminder});ripple.define("platform/webworks.handset/2.0.0/client/SearchArguments",function(ripple,exports,module){var _self=function(text,name){return{text:text,name:name}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/Task",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_uri="blackberry/pim/Task/";function Task(){var _self={save:function(){if(!_self.uid){_self.uid=Math.uuid(null,16)}transport.call(_uri+"save",{post:{task:_self}})},remove:function(){if(!_self.uid){throw"task has not yet been saved (has no uid)"}transport.call(_uri+"remove",{get:{id:_self.uid}})},uid:null,categories:[],due:null,note:"",priority:Task.PRIORITY_NORMAL,recurrence:null,reminder:null,status:Task.NOT_STARTED,summary:""};return _self}function _massage(property,name){if(name==="recurrence"&&property){if(property.end){property.end=new Date(property.end)}}if(name==="reminder"&&property){if(property.date){property.date=new Date(property.date)}}if(name==="due"&&property){property=new Date(property)}return property}Task.find=function(filter,orderBy,maxReturn,isAscending){return transport.call(_uri+"find",{post:{filter:filter,orderBy:orderBy,maxReturn:maxReturn,isAscending:isAscending}}).map(function(properties){var task=new Task,key;for(key in properties){if(task.hasOwnProperty(key)){task[key]=_massage(properties[key],key)}}return task})};Task.__defineGetter__("NOT_STARTED",function(){return 0});Task.__defineGetter__("IN_PROGRESS",function(){return 1});Task.__defineGetter__("COMPLETED",function(){return 2});Task.__defineGetter__("WAITING",function(){return 3});Task.__defineGetter__("DEFERRED",function(){return 4});Task.__defineGetter__("PRIORITY_HIGH",function(){return 0});Task.__defineGetter__("PRIORITY_NORMAL",function(){return 1});Task.__defineGetter__("PRIORITY_LOW",function(){return 2});module.exports=Task});ripple.define("platform/webworks.handset/2.0.0/client/TaskArguments",function(ripple,exports,module){var _self=function(task){return{view:0,task:task}};_self.__defineGetter__("VIEW_NEW",function(){return 0});_self.__defineGetter__("VIEW_EDIT",function(){return 1});module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/app",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_uri="blackberry/app/",_self;_self={exit:function(){transport.call(_uri+"exit",{async:true})},setHomeScreenIcon:function(uri,hover){transport.call(_uri+"setHomeScreenIcon",{get:{uri:uri,hover:hover},async:true});return true},setHomeScreenName:function(text){transport.call(_uri+"setHomeScreenName",{get:{text:text},async:true});return true},requestForeground:function(){transport.call(_uri+"requestForeground",{async:true})},requestBackground:function(){transport.call(_uri+"requestBackground",{async:true})},removeBannerIndicator:function(){transport.call(_uri+"removeBannerIndicator",{async:true})},showBannerIndicator:function(icon,count){transport.call(_uri+"showBannerIndicator",{get:{icon:icon,count:count},async:true})}};_self.__defineGetter__("author",function(){return transport.call(_uri+"author")});_self.__defineGetter__("authorEmail",function(){return transport.call(_uri+"authorEmail")});_self.__defineGetter__("authorURL",function(){return transport.call(_uri+"authorURL")});_self.__defineGetter__("copyright",function(){return transport.call(_uri+"copyright")});_self.__defineGetter__("description",function(){return transport.call(_uri+"description")});_self.__defineGetter__("id",function(){return transport.call(_uri+"id")});_self.__defineGetter__("isForeground",function(){return transport.call(_uri+"isForeground")});_self.__defineGetter__("license",function(){return transport.call(_uri+"license")});_self.__defineGetter__("licenseURL",function(){return transport.call(_uri+"licenseURL")});_self.__defineGetter__("name",function(){return transport.call(_uri+"name")});_self.__defineGetter__("version",function(){return transport.call(_uri+"version")});module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/appEvent",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_callbacks={},_self;function _poll(evt,handler){_callbacks[evt]=handler;transport.poll("blackberry/app/event/"+evt,{},function(){var func=_callbacks[evt];if(func){func()}return!!func})}_self={onBackground:function(handler){_poll("onBackground",handler)},onForeground:function(handler){_poll("onForeground",handler)},onExit:function(handler){_poll("onExit",handler)}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/audio",function(ripple,exports,module){module.exports={supportedContentTypes:function(protocol){return protocol==="rtsp"?["audio/amr","audio/mp4","audio/aac"]:["audio/midi","mpeg","x-wav","amr","basic","x-gsm","mp4","aac","x-ms-wma","flac","ogg"]},supportedProtocols:function(){return["http","file","rtsp"]}}});ripple.define("platform/webworks.handset/2.0.0/client/blackberry",function(ripple,exports,module){var blackberry={},transport=ripple("platform/webworks.core/2.0.0/client/transport");blackberry.__defineGetter__("network",function(){return transport.call("blackberry/system/network")});module.exports=blackberry});ripple.define("platform/webworks.handset/2.0.0/client/category",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_uri="blackberry/pim/category/",_self;_self={addCategory:function(categoryName){transport.call(_uri+"addCategory",{get:{categoryName:categoryName}})},deleteCategory:function(categoryName){transport.call(_uri+"deleteCategory",{get:{categoryName:categoryName}})},getCategories:function(){return transport.call(_uri+"getCategories")}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/identity/Service",function(ripple,exports,module){function Service(){return{emailAddress:null,isDefault:null,name:null,type:null}}Service.__defineGetter__("TYPE_EMAIL",function(){return 0});Service.__defineGetter__("TYPE_CALENDAR",function(){return 1});Service.__defineGetter__("TYPE_CONTACT",function(){return 2});module.exports=Service});ripple.define("platform/webworks.handset/2.0.0/client/identity/Transport",function(ripple,exports,module){function Transport(name,type){this.__defineGetter__("name",function(){return name||""});this.__defineGetter__("type",function(){return type||""})}module.exports=Transport});ripple.define("platform/webworks.handset/2.0.0/client/identity/phone",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_uri="blackberry/identity/phone/",_self;_self={getLineIds:function(){return transport.call(_uri+"getLineIds")},getLineLabel:function(id){return transport.call(_uri+"getLineLabel",{get:{id:id}})},getLineNumber:function(id){return transport.call(_uri+"getLineNumber",{get:{id:id}})},getLineType:function(id){return transport.call(_uri+"getLineType",{get:{id:id}})}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/identity",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_uri="blackberry/identity/",_self;_self={getDefaultService:function(){return transport.call(_uri+"getDefaultService")},getServiceList:function(){return transport.call(_uri+"getServiceList")},getTransportList:function(){return transport.call(_uri+"getTransportList")}};_self.__defineGetter__("IMEI",function(){return transport.call(_uri+"IMEI")});_self.__defineGetter__("IMSI",function(){return transport.call(_uri+"IMSI")});_self.__defineGetter__("PIN",function(){return transport.call(_uri+"PIN")});module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/invoke",function(ripple,exports,module){var _uri="blackberry/invoke/invoke",APP_URL_CAMERA="camera://",APP_URL_CAMERA_VIDEO="camera://video",APP_URL_MAP="map://",APP_BROWSER_ERROR="Protocol specified in the url is not supported.",APP_ADDRESSBOOK_ERROR="Invalid arguments specified",transport=ripple("platform/webworks.core/2.0.0/client/transport"),_self;_self={invoke:function(appType,args){var get={};switch(appType){case 0:if(args){if(args.view===1&&args.contact){throw APP_ADDRESSBOOK_ERROR}else if(args.view===2&&!args.contact){throw APP_ADDRESSBOOK_ERROR}}get.appType=appType;break;case 1:get.appType=appType;break;case 2:get.appType=appType;break;case 3:get.appType=appType;break;case 4:if(!args||args.view===1){get.appType=APP_URL_CAMERA_VIDEO}else{get.appType=APP_URL_CAMERA}break;case 5:get.appType=APP_URL_MAP;break;case 6:get.appType=appType;break;case 7:get.appType=appType;break;case 8:get.appType=appType;break;case 9:get.appType=appType;break;case 10:get.appType=appType;break;case 11:if(!args){get.appType="http://"}else{if(args.url&&!args.url.match(/^https?:\/\//)){throw APP_BROWSER_ERROR}get.appType=args.url}break;case 12:get.appType=appType;break;default:throw"appType not supported"}transport.call(_uri,{get:get,async:true})}};_self.__defineGetter__("APP_ADDRESSBOOK",function(){return 0});_self.__defineGetter__("APP_BLUETOOTH_CONFIG",function(){return 1});_self.__defineGetter__("APP_CALCULATOR",function(){return 2});_self.__defineGetter__("APP_CALENDAR",function(){return 3});_self.__defineGetter__("APP_CAMERA",function(){return 4});_self.__defineGetter__("APP_MAPS",function(){return 5});_self.__defineGetter__("APP_MEMOPAD",function(){return 6});_self.__defineGetter__("APP_MESSAGES",function(){return 7});_self.__defineGetter__("APP_PHONE",function(){return 8});_self.__defineGetter__("APP_SEARCH",function(){return 9});_self.__defineGetter__("APP_TASKS",function(){return 10});_self.__defineGetter__("APP_BROWSER",function(){return 11});_self.__defineGetter__("APP_JAVA",function(){return 12});module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/io/dir",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),dir=ripple("platform/webworks.core/2.0.0/client/io/dir"),utils=ripple("utils"),_uri="blackberry/io/dir/",FILE="file://",_self={};function _prunePrefix(path){return path.replace(new RegExp("^"+FILE),"")}utils.mixin({getFreeSpaceForRoot:function(path){return transport.call(_uri+"getFreeSpaceForRoot",{post:{path:_prunePrefix(path)}})},getRootDirs:function(){return transport.call(_uri+"getRootDirs",{}).map(function(dir){return FILE+dir})}},_self);utils.mixin(dir,_self);module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/menu",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),MenuItem=ripple("platform/webworks.handset/2.0.0/client/MenuItem"),utils=ripple("utils"),_items={},_uri="blackberry/ui/menu/",_self;_self={addMenuItem:function(menuItem){_items[menuItem.id]=menuItem;transport.call(_uri+"addMenuItem",{get:{item:menuItem}});if(utils.count(_items)===1){transport.poll(_uri+"onSelect",{},function(response){var item=_items[response];if(item&&item.callback){item.callback()}return!!utils.count(_items)})}},clearMenuItems:function(){_items={};transport.call(_uri+"clearMenuItems")},getMenuItems:function(){return utils.map(_items,function(item){var menuItem=new MenuItem(item.isSeparator,item.ordinal,item.caption,item.callback);menuItem.id=item.id;menuItem.isDefault=item.isDefault;return menuItem})},hasMenuItem:function(menuItem){return!!_items[menuItem.id]},open:function(){transport.call(_uri+"open",{async:true})},removeMenuItem:function(menuItem){delete _items[menuItem.id];transport.call(_uri+"removeMenuItem",{get:{item:menuItem}})},setDefaultMenuItem:function(menuItem){utils.forEach(_items,function(item){item.isDefault=false});_items[menuItem.id].isDefault=true;transport.call(_uri+"setDefaultMenuItem",{get:{id:menuItem.id}})}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/messaging",function(ripple,exports,module){module.exports={}});ripple.define("platform/webworks.handset/2.0.0/client/pim",function(ripple,exports,module){module.exports={}});ripple.define("platform/webworks.handset/2.0.0/client/push",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_self,_uri="blackberry/push/onPush",callbacks={},PushData=ripple("platform/webworks.handset/2.0.0/client/PushData");_self={openPushListener:function(callback,port,bbTransport,maxQueueCap){callbacks["onPush"+port]=callback;transport.poll(_uri,{get:{port:port,bbTransport:bbTransport,maxQueueCap:maxQueueCap}},function(response){var func=callbacks["onPush"+port];if(func){func(new PushData(response,port))}return!!func})},closePushListener:function(port){delete callbacks["onPush"+port]}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/sms",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_uri="blackberry/message/sms/",onReceive,_self;_self={addReceiveListener:function(callback){onReceive=callback;transport.poll(_uri+"onReceive",{},function(response){if(onReceive){onReceive(response.body,response.from,response.time)}return!!onReceive})},removeReceiveListener:function(){if(onReceive){onReceive=null;return true}return false},send:function(message,address){transport.call(_uri+"send",{get:{message:message,address:address},async:true})}};_self.__defineGetter__("isListeningForMessage",function(){return transport.call(_uri+"isListeningForMessage",{async:false})});_self.__defineSetter__("isListeningForMessage",function(value){transport.call(_uri+"isListeningForMessage",{async:false,get:{isListeningForMessage:value}})});module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/system",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),system=ripple("platform/webworks.core/2.0.0/client/system"),_uri="blackberry/system/",_self;_self={setHomeScreenBackground:function(filePath){transport.call(_uri+"setHomeScreenBackground",{get:{filePath:filePath},async:true})}};(function(){function get(i){return function(){return system[i]}}for(var key in system){if(system.hasOwnProperty(key)){_self.__defineGetter__(key,get(key))}}})();module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/client/systemEvent",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_self,_callbacks={};function _poll(evt,args,callback){_callbacks[evt+args.key]=callback;transport.poll("blackberry/system/event/"+evt,{get:args},function(){var func=_callbacks[evt+args.key];if(func){func()}return!!func})}_self={onCoverageChange:function(callback){_poll("onCoverageChange",{},callback)},onHardwareKey:function(key,callback){_poll("onHardwareKey",{key:key},callback)}};_self.__defineGetter__("KEY_BACK",function(){return 0});_self.__defineGetter__("KEY_MENU",function(){return 1});_self.__defineGetter__("KEY_CONVENIENCE_1",function(){return 2});_self.__defineGetter__("KEY_CONVENIENCE_2",function(){return 3});_self.__defineGetter__("KEY_STARTCALL",function(){return 4});_self.__defineGetter__("KEY_ENDCALL",function(){return 5});_self.__defineGetter__("KEY_VOLUMEDOWN",function(){return 6});_self.__defineGetter__("KEY_VOLUMEUP",function(){return 7});module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/server/Task",function(ripple,exports,module){var select=ripple("platform/webworks.core/2.0.0/select"),db=ripple("db"),utils=ripple("utils"),_KEY="blackberry-pim-task",_self;function _get(){return db.retrieveObject(_KEY)||{}}function _save(tasks){db.saveObject(_KEY,tasks)}_self={save:function(get,post){var tasks=_get(),properties=post.task,id=properties.uid;if(tasks[id]){utils.mixin(properties,tasks[id])}else{tasks[id]=properties}_save(tasks);return{code:1}},remove:function(get){var tasks=_get(),id=get.id;delete tasks[id];_save(tasks);return{code:1}},find:function(get,post){var tasks=_get(),match=select.from(tasks);if(post.orderBy){match.orderBy(post.orderBy,post.isAscending===false?"desc":"asc")}if(post.maxReturn){match.max(post.maxReturn)}return{code:1,data:match.where(post.filter)}}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/server/app",function(ripple,exports,module){var event=ripple("event"),app=ripple("app"),notifications=ripple("notifications"),ui=ripple("ui"),_isForeground=true,_self;_self={event:ripple("platform/webworks.handset/2.0.0/server/appEvent"),exit:function(){event.trigger("AppExit");return{code:1}},author:function(){return{code:1,data:app.getInfo().author}},authorEmail:function(){return{code:1,data:app.getInfo().authorEmail}},authorURL:function(){return{code:1,data:app.getInfo().authorURL}},copyright:function(){return{code:1,data:app.getInfo().copyright}},description:function(){return{code:1,data:app.getInfo().description}},isForeground:function(){return{code:1,data:_isForeground}},id:function(){return{code:1,data:app.getInfo().id}},license:function(){return{code:1,data:app.getInfo().license}},licenseURL:function(){return{code:1,data:app.getInfo().licenseURL}},name:function(){return{code:1,data:app.getInfo().name}},version:function(){return{code:1,data:app.getInfo().version}},requestBackground:function(){ui.showOverlay("background-window",function(background){var button=background.children["background-return"];if(button){button.addEventListener("click",_self.requestForeground)}_isForeground=false;event.trigger("AppRequestBackground")});return{code:1}},requestForeground:function(){ui.hideOverlay("background-window",function(background){var button=background.children["background-return"];if(button){button.removeEventListener("click",_self.requestForeground)}_isForeground=true;event.trigger("AppRequestForeground")});return{code:1}},setHomeScreenIcon:function(args){if(args.uri){var msg="The application set the home screen"+(args.hover?" hover ":" ")+"icon to "+args.uri;notifications.openNotification("normal",msg);return{code:1}}else{return{code:0}}},setHomeScreenName:function(args){if(args.text){var msg="The application set the home screen name to "+args.text;notifications.openNotification("normal",msg);return{code:1}}else{return{code:1}}},removeBannerIndicator:function(){event.trigger("BannerUpdated",["",0]);return{code:1}},showBannerIndicator:function(args){event.trigger("BannerUpdated",[args.icon,args.count]);return{code:1}}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/server/appEvent",function(ripple,exports,module){var event=ripple("event"),notifications=ripple("notifications"),_bg,_fg,_exit;event.on("AppRequestBackground",function(){var baton=_bg;_bg=null;return baton&&baton.pass({code:1})});event.on("AppRequestForeground",function(){var baton=_fg;_fg=null;return baton&&baton.pass({code:1})});event.on("AppExit",function(){var baton=_exit;_exit=null;notifications.openNotification("normal","blackberry.app.exit() as called, in the real world your app will exit, here... you get this notification");
return baton&&baton.pass({code:1})});module.exports={onBackground:function(get,post,baton){baton.take();_bg=baton;return{code:1}},onForeground:function(get,post,baton){baton.take();_fg=baton;return{code:1}},onExit:function(get,post,baton){baton.take();_exit=baton;return{code:1}}}});ripple.define("platform/webworks.handset/2.0.0/server/appointment",function(ripple,exports,module){var db=ripple("db"),select=ripple("platform/webworks.core/2.0.0/select"),_self;function _get(){return db.retrieveObject("webworks-pim-appointment-list")||{}}function _do(func){var appointments=_get();func(appointments);db.saveObject("webworks-pim-appointment-list",appointments)}_self={find:function(get,post){var appointments=_get(),data=select.from(appointments).orderBy(post.orderBy,post.isAscending===false?"desc":"asc").max(post.maxReturn).where(post.filter);return{code:1,data:data}},remove:function(get){_do(function(appointments){if(!appointments[get.uid]){throw"attempting to delete a non existent appointment with uid: "+get.uid}delete appointments[get.uid]});return{code:1}},save:function(get,post){_do(function(appointments){appointments[post.appointment.uid]=post.appointment});return{code:1}}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/server/audioPlayer",function(ripple,exports,module){var utils=ripple("utils"),notifications=ripple("notifications"),Player=ripple("platform/webworks.handset/2.0.0/client/AudioPlayer"),_handlers={loadstart:{},canplaythrough:{},durationchange:{},ended:{},error:{},play:{},pause:{},volumechange:{},close:{}},extract={time:function(audio){return audio.currentTime},duration:function(audio){return audio.duration},error:function(audio){return audio.error},nothing:function(){return null}},container;container=utils.createElement("section",{id:"webworks-audio-players"});document.getElementById("ui").appendChild(container);function _errClosed(method){notifications.openNotification("error","attempted to call "+method+" on a player that is already closed. This is a very bad thing to do :)");return false}function _removeHandler(type,id){var audio=document.getElementById(id);if(audio&&_handlers[type][id]){audio.removeEventListener(type,_handlers[type][id]);delete _handlers[type][id]}}function _addHandler(type,id,callback){var audio=document.getElementById(id);if(audio){_removeHandler(type,id);audio.addEventListener(type,callback);_handlers[type][id]=callback}}function proxyEvent(from,map){var audio=document.getElementById(map.id);if(audio){map.baton.take();_addHandler(from,map.id,function(){_removeHandler(from,map.id);map.baton.pass({code:1,data:{event:map.target,eventData:map.data(this)}})})}else{return{code:-1,data:{event:"EVENT_ERROR",eventData:5}}}}module.exports={create:function(args){var id=Math.uuid(),audio=utils.createElement("audio",{id:id});audio.setAttribute("src",args.locator);if(args.type){audio.setAttribute("type",args.type)}container.appendChild(audio);audio.load();if(audio.error){throw"there was a problem opening the audio file"}return{code:1,data:id}},play:function(args){var audio=document.getElementById(args.id),playing;if(audio){audio.play();audio.rimState=Player.STARTED;playing=!!!audio.error}else{playing=_errClosed("play")}return{code:1,data:playing}},pause:function(args){var audio=document.getElementById(args.id),paused;if(audio){audio.pause();paused=!!!audio.error}else{paused=_errClosed("pause")}return{code:1,data:paused}},close:function(args){var audio=document.getElementById(args.id),callback=_handlers["close"][args.id],closed=true;if(audio){if(callback){callback()}container.removeChild(audio)}else{closed=_errClosed("close")}return{code:1,data:closed}},onStart:function(args,post,baton){return proxyEvent("play",{id:args.id,baton:baton,target:"EVENT_START",data:extract.time})},onStopped:function(args,post,baton){return proxyEvent("pause",{id:args.id,baton:baton,target:"EVENT_STOPPED",data:extract.time})},onBufferingStarted:function(args,post,baton){return proxyEvent("loadstart",{id:args.id,baton:baton,target:"EVENT_BUFFERING_STARTED",data:extract.time})},onBufferingStopped:function(args,post,baton){return proxyEvent("canplaythrough",{id:args.id,baton:baton,target:"EVENT_BUFFERING_STOPPED",data:extract.time})},onDurationUpdated:function(args,post,baton){return proxyEvent("durationchange",{id:args.id,baton:baton,target:"EVENT_DURATION_UPDATED",data:extract.duration})},onEnd:function(args,post,baton){return proxyEvent("ended",{id:args.id,baton:baton,target:"EVENT_END_OF_MEDIA",data:extract.duration})},onError:function(args,post,baton){return proxyEvent("error",{id:args.id,baton:baton,target:"EVENT_ERROR",data:extract.error})},onVolumeChange:function(args,post,baton){return proxyEvent("volumechange",{id:args.id,baton:baton,target:"EVENT_VOLUME_CHANGED",data:extract.nothing})},onClose:function(args,post,baton){return proxyEvent("close",{id:args.id,baton:baton,target:"EVENT_CLOSED",data:extract.nothing})},getDuration:function(args){var audio=document.getElementById(args.id),duration;if(audio){duration=audio.duration}else{_errClosed("getDuration");duration=-1}return{code:1,data:duration}},getMediaTime:function(args){var audio=document.getElementById(args.id),time;if(audio){time=audio.currentTime}else{_errClosed("getMediaTime");time=-1}return{code:1,data:time}},setMediaTime:function(args){var audio=document.getElementById(args.id);if(audio){audio.currentTime=args.value}else{_errClosed("setMediaTime")}return{code:1}},getVolumeLevel:function(args){var audio=document.getElementById(args.id),level;if(audio){level=audio.volume*100}else{_errClosed("getVolumeLevel");level=-1}return{code:1,data:level}},setVolumeLevel:function(args){var audio=document.getElementById(args.id);if(audio){audio.volume=args.value/100}else{_errClosed("setVolumeLevel")}return{code:1}},getState:function(args){var audio=document.getElementById(args.id),state=audio?audio.rimState||Player.PREFETCHED:Player.CLOSED;return{code:1,data:state}}}});ripple.define("platform/webworks.handset/2.0.0/server/category",function(ripple,exports,module){var db=ripple("db"),_KEY="blackberry-pim-category",_self;function _get(){return db.retrieveObject(_KEY)||[]}function _save(category){var categories=_get();if(!categories.some(function(item){return item===category})){categories.push(category);db.saveObject(_KEY,categories)}}function _remove(category){var categories=_get(),index=categories.indexOf(category);if(index>=0){categories.splice(index,1);db.saveObject(_KEY,categories)}}_self={addCategory:function(args){_save(args.categoryName);return{code:1}},deleteCategory:function(args){_remove(args.categoryName);return{code:1}},getCategories:function(){return{code:1,data:_get()}}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/server/contact",function(ripple,exports,module){var select=ripple("platform/webworks.core/2.0.0/select"),db=ripple("db"),_KEY="blackberry-pim-contacts",_self;function _defaultContacts(){var id1=Math.uuid(null,16),id2=Math.uuid(null,16),id3=Math.uuid(null,16),id4=Math.uuid(null,16),contacts={};contacts[id1]={uuid:id1,firstName:"Leonardo",homePhone:"4567892345",email1:"leo@underground.com"};contacts[id2]={uuid:id2,firstName:"Raphael",homePhone:"4563457890",email1:"raph@underground.com"};contacts[id3]={uuid:id3,firstName:"Michelangelo",homePhone:"4563453425",email1:"mike@underground.com"};contacts[id4]={uuid:id4,firstName:"Donatello",homePhone:"4563453425",email1:"don@undergound.com"};return contacts}function _get(){return db.retrieveObject(_KEY)||_defaultContacts()}function _save(contacts){db.saveObject(_KEY,contacts)}_self={save:function(get,post){var contacts=_get();contacts[post.contact.uid]=post.contact;_save(contacts);return{code:1}},remove:function(get){var contacts=_get(),id=get.id;delete contacts[id];_save(contacts);return{code:1}},find:function(get,post){var contacts=_get(),match=select.from(contacts);if(post.orderBy){match.orderBy(post.orderBy,post.isAscending===false?"desc":"asc")}if(post.maxReturn){match.max(post.maxReturn)}return{code:1,data:match.where(post.fieldFilter)}}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/server/identity/phone",function(ripple,exports,module){var _lines=[{id:1,number:12345678910,label:"rogers",type:1},{id:2,number:10987654321,label:"mystery",type:0}],_self;function _filterLines(args){var result=_lines;if(args&&typeof args.id==="number"){result=_lines.filter(function(line){return line.id===args.id});if(result.length===0){throw"invalid line id: "+args.id}}return result}_self={getLineIds:function(){var lines=_lines.map(function(line){return line.id});return{code:1,data:lines}},getLineLabel:function(args){return{code:1,data:_filterLines(args)[0].label}},getLineNumber:function(args){return{code:1,data:_filterLines(args)[0].number}},getLineType:function(args){return{code:1,data:_filterLines(args)[0].type}}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/server/identity",function(ripple,exports,module){var _self,Service=ripple("platform/webworks.handset/2.0.0/client/identity/Service"),Transport=ripple("platform/webworks.handset/2.0.0/client/identity/Transport"),utils=ripple("utils"),deviceSettings=ripple("deviceSettings"),_transportTypes=[{name:"TCP Cellular",type:"TCP Cellular"},{name:"Wap",type:"Wap"},{name:"Wap 2.0",type:"Wap 2.0"},{name:"MDS",type:"MDS"},{name:"BIS B",type:"Bis B"},{name:"Unite!",type:"Unite!"},{name:"TCP Wifi",type:"TCP Wifi"}],_services=[new Service,new Service];function _isTransportAvailable(transport){return deviceSettings.retrieveAsBoolean("transports."+transport.type)}utils.mixin({name:"Super Dave Osborne",emailAddress:"dave@stunt.com",isDefault:true,type:Service.TYPE_EMAIL},_services[0]);utils.mixin({name:"Fred Penner",emailAddress:"fred@fredpenner.com",isDefault:false,type:Service.TYPE_CONTACT},_services[1]);_self={getDefaultService:function(){var services=_services.filter(function(service){return service.isDefault===true});return{code:1,data:services}},getServiceList:function(){return{code:1,data:_services}},getTransportList:function(){var transports=_transportTypes.filter(function(transport){return _isTransportAvailable(transport)}).map(function(transport){return new Transport(transport.name,transport.type)});return{code:1,data:transports}},IMEI:function(){return{code:1,data:deviceSettings.retrieve("identity.IMEI")}},IMSI:function(){return{code:1,data:deviceSettings.retrieve("identity.IMSI")}},PIN:function(){return{code:1,data:deviceSettings.retrieve("identity.PIN")}},phone:ripple("platform/webworks.handset/2.0.0/server/identity/phone")};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/server/invoke",function(ripple,exports,module){var notifications=ripple("notifications"),type="normal",name={0:"Address Book",1:"Bluetooth Config",2:"Calculator",3:"Calendar","camera://":"Camera","camera://video":"Video Camera","map://":"Maps",6:"Memopad",7:"Messages",8:"Phone",9:"Search",10:"Tasks",11:"Browser","http://":"Browser",12:"Java"};module.exports={invoke:function(opts){var app=name[opts.appType];if(app===undefined&&opts.appType&&opts.appType.match(/^http/i)){app="Browser"}notifications.openNotification(type,"Requested to launch: "+app+" application.");return{code:1}}}});ripple.define("platform/webworks.handset/2.0.0/server/io/dir",function(ripple,exports,module){var cache=ripple("platform/webworks.core/2.0.0/fsCache"),dir=ripple("platform/webworks.core/2.0.0/server/io/dir"),utils=ripple("utils"),_self={};function _packet(data){return{code:1,data:data}}utils.mixin({getFreeSpaceForRoot:function(get,post){return _packet(cache.dir.getFreeSpaceForRoot(post.path))},getRootDirs:function(){return _packet(cache.dir.getRootDirs())}},_self);utils.mixin(dir,_self);module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/server/memo",function(ripple,exports,module){var db=ripple("db"),select=ripple("platform/webworks.core/2.0.0/select"),_self;function _get(){return db.retrieveObject("webworks-pim-memo-list")||{}}function _do(func){var memos=_get();func(memos);db.saveObject("webworks-pim-memo-list",memos)}_self={find:function(get,post){var memos=select.from(_get()).orderBy(post.orderBy,post.isAscending===false?"desc":"asc").max(post.maxReturn).where(post.filter);return{code:1,data:memos}},remove:function(get){_do(function(memos){if(!memos[get.uid]){throw"attempting to delete a non existent memo with uid: "+get.uid}delete memos[get.uid]});return{code:1}},save:function(get,post){_do(function(memos){memos[post.memo.uid]=post.memo});return{code:1}}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/server/menu",function(ripple,exports,module){var _menuItems={},event=ripple("event"),ui=ripple("ui"),utils=ripple("utils"),tooltip=ripple("ui/plugins/tooltip"),_self,isMenuOpen=false,_baton,menuWindow=document?document.getElementById("menu-window"):undefined;if(menuWindow){menuWindow.addEventListener("click",function(){_self.close()})}event.on("LayoutChanged",function(){if(isMenuOpen){_self.close();_self.open()}});event.on("HardwareKeyDefault",function(key){if(key===1||key==="1"){if(isMenuOpen){_self.close()}else{_self.open()}}});event.on("MenuItemSelected",function(menuItem){var baton=_baton;_baton=null;return baton&&baton.pass({code:1,data:menuItem})});event.on("MenuItemChanged",function(menuItem){_menuItems[menuItem.id]=menuItem});_self={onSelect:function(args,post,baton){baton.take();_baton=baton},addMenuItem:function(args){if(!args){throw"item not found"}_menuItems[args.item.id]=args.item;event.trigger("MenuChanged",[_menuItems]);return{code:1}},clearMenuItems:function(){_menuItems={};event.trigger("MenuChanged",[utils.copy(_menuItems)]);return{code:1}},open:function(){function _return(){return{code:1}}if(utils.count(_menuItems)===0){_return()}ui.showOverlay("menu-window",function(menu){var container=document.getElementById("viewport-container"),height=window.getComputedStyle(container,null).getPropertyValue("height"),width=window.getComputedStyle(container,null).getPropertyValue("width"),menuButtons=document.getElementById("menu-buttons"),sorted,menuItem;if(!menuButtons){_return()}menu.setAttribute("style","display:block;height:"+height+"; width:"+width+";");isMenuOpen=true;sorted=utils.map(_menuItems,function(item){return item}).sort(function(a,b){return a.ordinal-b.ordinal});menuButtons.innerHTML="";sorted.forEach(function(item){if(!item.isSeparator){if(item.isDefault){menuItem=utils.createElement("div",{"class":"overlay-menu-item-default",id:"default-menu-item"})}else{menuItem=utils.createElement("div",{"class":"overlay-menu-item"})}menuItem.innerHTML=item.caption;menuItem.addEventListener("click",function(){_baton.pass({code:1,data:item.id})})}else{menuItem=utils.createElement("hr",{})}menuButtons.appendChild(menuItem);tooltip.create("#default-menu-item","Default Item")})},true);event.trigger("MenuOpened",[]);_return()},close:function(){ui.hideOverlay("menu-window",function(menu){var menuButtons=document.getElementById("menu-buttons");menuButtons.innerHTML="";isMenuOpen=false;menu.setAttribute("style","display:none;")});return{code:1}},removeMenuItem:function(args){delete _menuItems[args.item.id];event.trigger("MenuChanged",[_menuItems]);return{code:1}},setDefaultMenuItem:function(args){utils.forEach(_menuItems,function(item){item.isDefault=false});_menuItems[args.id].isDefault=true;event.trigger("DefaultItemChanged",[_menuItems[args.id]]);return{code:1}}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/server/message",function(ripple,exports,module){var db=ripple("db"),utils=ripple("utils"),select=ripple("platform/webworks.core/2.0.0/select"),Message=ripple("platform/webworks.handset/2.0.0/client/Message"),_self;function _get(){return db.retrieveObject("webworks-message-list")||{}}function _do(func){var messages=_get();func(messages);db.saveObject("webworks-message-list",messages)}_self={find:function(get,post){var data=select.from(_get()).max(post.maxReturn).where(post.filter);return{code:1,data:data}},remove:function(get){_do(function(messages){if(!messages[get.uid]){throw"attempting to delete a non existent message with uid: "+get.uid}delete messages[get.uid]});return{code:1}},save:function(get,post){_do(function(messages){var orig=messages[post.message.uid],updated=utils.copy(post.message);updated.folder=orig?orig.folder:Message.FOLDER_DRAFT;updated.status=orig?orig.status:Message.STATUS_DRAFT;messages[post.message.uid]=updated});return{code:1}},send:function(get){_do(function(messages){var updated=utils.copy(get.message);updated.folder=Message.FOLDER_SENT;updated.status=Message.STATUS_SENT;messages[updated.uid]=updated});return{code:1}}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/server/phone",function(ripple,exports,module){var PhoneCall=ripple("platform/webworks.handset/2.0.0/client/PhoneCall"),PhoneLogs=ripple("platform/webworks.handset/2.0.0/client/PhoneLogs"),CallLog=ripple("platform/webworks.handset/2.0.0/client/CallLog"),select=ripple("platform/webworks.core/2.0.0/select"),event=ripple("event"),utils=ripple("utils"),db=ripple("db"),_KEY="blackberry-phone-logs",_onPhoneEventListeners={},_activeCalls={},_onCallLogAdded,_onCallLogRemoved,_onCallLogUpdated,_onCallLogReset,_self;function _defaultLogs(){var n1=new CallLog,n2=new CallLog,m1=new CallLog,m2=new CallLog;n1.number="12344567";n1.name="larry";n1.type=CallLog.TYPE_PLACED_CALL;n1.status=CallLog.STATUS_NORMAL;n2.number="14567890";n2.name="curly";n2.type=CallLog.TYPE_RECEIVED_CALL;n2.status=CallLog.STATUS_NORMAL;m1.number="17659800";m1.name="moe";m1.type=CallLog.TYPE_MISSED_CALL_UNOPENED;m1.status=CallLog.STATUS_NORMAL;m2.number="14567896";m2.name="snarf";m2.type=CallLog.TYPE_MISSED_CALL_OPENED;m2.status=CallLog.STATUS_NORMAL;return{normal:[n1,n2],missed:[m1,m2]}}function _getLogs(folderID){var logs=db.retrieveObject(_KEY)||_defaultLogs();return folderID===undefined||folderID===null?logs:logs[folderID!==PhoneLogs.FOLDER_NORMAL_CALLS?"missed":"normal"]}function _saveLogs(logs){db.saveObject(_KEY,logs)}function _isMissedCall(log){return log.type===CallLog.TYPE_MISSED_CALL_UNOPENED||log.type===CallLog.TYPE_MISSED_CALL_OPENED?true:false}function _isNormalCall(log){return log.type===CallLog.TYPE_RECEIVED_CALL||log.type===CallLog.TYPE_PLACED_CALL?true:false}event.on("PhoneEvent",function(type,callId,error){var baton=_onPhoneEventListeners[type];delete _onPhoneEventListeners[type];return baton&&baton.pass({code:1,data:{callId:callId,error:error}})});event.on("PhoneCallLogAdded",function(log){var logs=_getLogs(),baton=_onCallLogAdded;logs[_isMissedCall(log)?"missed":"normal"].push(log);_saveLogs(logs);_onCallLogAdded=null;return baton&&baton.pass({code:1,data:{log:log}})});event.on("PhoneCallLogRemoved",function(log){var baton=_onCallLogRemoved;_onCallLogRemoved=null;return baton&&baton.pass({code:1,data:{log:log}})});event.on("PhoneCallLogUpdated",function(newLog,oldLog){var baton=_onCallLogUpdated;_onCallLogUpdated=null;return baton&&baton.pass({code:1,data:{newLog:newLog,oldLog:oldLog}})});event.on("PhoneCallLogReset",function(){_saveLogs(_defaultLogs());var baton=_onCallLogReset;_onCallLogReset=null;return baton&&baton.pass({code:1})});event.on("PhoneCallInitiated",function(call){_activeCalls[call.id]=call});event.on("PhoneCallEnded",function(call){delete _activeCalls[call.id]});_self={logs:{onCallLogAdded:function(get,post,baton){baton.take();_onCallLogAdded=baton},onCallLogRemoved:function(get,post,baton){baton.take();_onCallLogRemoved=baton},onCallLogUpdated:function(get,post,baton){baton.take();_onCallLogUpdated=baton},onCallLogReset:function(get,post,baton){baton.take();_onCallLogReset=baton},callAt:function(get){var logs=_getLogs(get.folderID!==null&&get.folderID!==undefined?get.folderID:PhoneLogs.FOLDER_MISSED_CALLS);return{code:1,data:logs.length>get.index?logs[get.index]:null}},deleteCallAt:function(get){var logs=_getLogs(),subLog=_getLogs(get.folderID),deleted=false,type,log;if(subLog.length>get.index&&(type=_isNormalCall(subLog[get.index])?"normal":"missed")&&(log=logs[type].splice(get.index,1))){event.trigger("PhoneCallLogRemoved",[log]);_saveLogs(logs);deleted=true}return{code:1,data:deleted}},find:function(get,post){var data=select.from(_getLogs(post.folderID!==null&&post.folderID!==undefined?post.folderID:PhoneLogs.FOLDER_MISSED_CALLS)).orderBy(post.orderBy,post.isAscending===false?"desc":"asc").max(post.maxReturn).where(post.filter,select.ops.phone);return{code:1,data:data}},numberOfCalls:function(get){return{code:1,data:_getLogs(get.folderID!==null&&get.folderID!==undefined?get.folderID:PhoneLogs.FOLDER_MISSED_CALLS).length}}},onPhoneEvent:function(get,post,baton){baton.take();_onPhoneEventListeners[get.eventType]=baton},activeCalls:function(){var data=utils.map(_activeCalls,function(callItem){var call=new PhoneCall(callItem.onhold);call.outgoing=callItem.outgoing;call.recipientName=callItem.recipient.name;call.recipientNumber=callItem.recipient.number;return call});return{code:1,data:data}},inActiveCall:function(){return{code:1,data:utils.count(_activeCalls)>0?true:false}}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/server/push",function(ripple,exports,module){var event=ripple("event"),utils=ripple("utils"),_handlers={},_self;function listenersChanged(){var ports=utils.map(_handlers,function(handler){return handler.port});event.trigger("PushListenersChanged",[ports])}event.on("Push",function(data,port){var handler=_handlers["port_"+port];delete _handlers["port_"+port];window.setTimeout(function(){if(!_handlers["port_"+port]){listenersChanged()}},100);return handler&&handler.baton.pass({code:1,data:data})});_self={onPush:function(args,post,baton){if(!args.port){throw"no port specified"}else if(typeof args.port!=="number"){throw"port is not a number"}baton.take();_handlers["port_"+args.port]={port:args.port,baton:baton};listenersChanged()}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/server/sms",function(ripple,exports,module){var _isListening=false,notifications=ripple("notifications"),event=ripple("event"),_console=ripple("console"),_onReceive,_self;event.on("MessageReceived",function(message){if(!_isListening||message.type!=="sms"){return}var baton=_onReceive;_onReceive=null;_isListening=false;return baton&&baton.pass({code:1,data:message})});_self={onReceive:function(args,post,baton){baton.take();_onReceive=baton;_isListening=!!_onReceive},send:function(args){var msg="To "+args.address+": "+args.message;notifications.openNotification("normal",msg);_console.log(msg);return{code:1}},isListeningForMessage:function(get){if(get&&typeof get.isListeningForMessage==="boolean"){_isListening=get.isListeningForMessage}return{code:1,data:_isListening}}};module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/server/systemEvent",function(ripple,exports,module){var event=ripple("event"),_onCoverageChange,_onHardwareKey={};event.on("CoverageChange",function(){var baton=_onCoverageChange;_onCoverageChange=null;return baton&&baton.pass({code:1})});event.on("HardwareKey",function(key){var baton=_onHardwareKey["key_"+key];delete _onHardwareKey["key_"+key];if(baton){baton.pass({code:1})}else{event.trigger("HardwareKeyDefault",[key])}});module.exports={onCoverageChange:function(args,post,baton){baton.take();_onCoverageChange=baton},onHardwareKey:function(args,post,baton){baton.take();_onHardwareKey["key_"+args.key]=baton}}});ripple.define("platform/webworks.handset/2.0.0/server",function(ripple,exports,module){var utils=ripple("utils"),platform="platform/webworks.handset/2.0.0/server/",core="platform/webworks.core/2.0.0/server/",systemEvent=ripple(platform+"systemEvent"),system={};system.event=systemEvent;utils.mixin(ripple(core+"system"),system);module.exports={blackberry:{invoke:ripple(platform+"invoke"),system:system,app:ripple(platform+"app"),identity:ripple(platform+"identity"),message:{sms:ripple(platform+"sms"),message:ripple(platform+"message")},push:ripple(platform+"push"),pim:{Task:ripple(platform+"Task"),category:ripple(platform+"category"),memo:ripple(platform+"memo"),appointment:ripple(platform+"appointment"),contact:ripple(platform+"contact")},audio:{player:ripple(platform+"audioPlayer")},ui:{menu:ripple(platform+"menu"),dialog:ripple(core+"dialog")},phone:ripple(platform+"phone"),io:{dir:ripple(platform+"io/dir"),file:ripple(core+"io/file")}}}});ripple.define("platform/webworks.handset/2.0.0/spec/device",function(ripple,exports,module){var event=ripple("event");module.exports={transports:{"TCP Cellular":{name:"Cellular TCP",control:{type:"checkbox",value:true}},Wap:{name:"WAP",control:{type:"checkbox",value:false}},"Wap 2.0":{name:"WAP 2.0",control:{type:"checkbox",value:false}},MDS:{name:"MDS",control:{type:"checkbox",value:true}},"Bis B":{name:"BIS B",control:{type:"checkbox",value:true}},"Unite!":{name:"Unite",control:{type:"checkbox",value:false}},"TCP Wifi":{name:"Wifi TCP",control:{type:"checkbox",value:true}}},identity:{IMEI:{name:"IMEI",control:{type:"text",value:"123456786543210"}},IMSI:{name:"IMSI",control:{type:"text",value:"310150123456789"}},PIN:{name:"PIN",control:{type:"text",value:"43A8C489"}}},system:{isMassStorageActive:{name:"Mass Storage Is Connected",control:{type:"checkbox",value:true}},hasDataCoverage:{name:"Has Data Coverage",control:{type:"checkbox",value:true},callback:function(setting){event.trigger("CoverageChange");ripple("bus").send("network",setting)}},lag:{name:"Lag the network",control:{type:"checkbox",value:false},callback:function(setting){ripple("bus").send("lag",setting)}},network:{name:"Data Network",control:{type:"select",value:"3GPP"},options:{"3GPP":"3GPP",CDMA:"CDMA",iDEN:"iDEN","Wi-Fi":"Wi-Fi"},callback:function(){event.trigger("CoverageChange")}}}}});ripple.define("platform/webworks.handset/2.0.0/spec/events",function(ripple,exports,module){var _self,utils=ripple("utils"),event=ripple("event"),events=ripple("platform/webworks.core/2.0.0/spec/events");_self={"system.event.onExit":{callback:function(){event.trigger("AppExit")}},"system.event.onCoverageChange":{callback:function(){event.trigger("CoverageChange")}},"system.event.onHardwareKey":{args:["Back","Menu","Convenience 1","Convenience 2","Start Call","End Call","Volume Down","Volume Up"],callback:function(key){event.trigger("HardwareKey",[key])}}};utils.mixin(events,_self);module.exports=_self});ripple.define("platform/webworks.handset/2.0.0/spec/ui",function(ripple,exports,module){module.exports={plugins:["accelerometer","deviceSettings","geoView","platformEvents","widgetConfig","messaging","push","phone","build"]}});ripple.define("platform/webworks.handset/2.0.0/spec",function(ripple,exports,module){module.exports={id:"webworks.handset",version:"2.0.0",name:"WebWorks",persistencePrefix:"rim-handset-",ui:ripple("platform/webworks.handset/2.0.0/spec/ui"),device:ripple("platform/webworks.handset/2.0.0/spec/device"),config:ripple("platform/webworks.core/2.0.0/spec/config"),events:ripple("platform/webworks.handset/2.0.0/spec/events"),initialize:function(){ripple("platform/webworks.core/2.0.0/fsCache");ripple("platform/webworks.core/2.0.0/fs").initialize()},objects:{XMLHttpRequest:{path:"webworks.handset/2.0.0/XMLHttpRequest"},Coordinates:{path:"w3c/1.0/Coordinates"},Position:{path:"w3c/1.0/Position"},PositionError:{path:"w3c/1.0/PositionError"},navigator:{path:"w3c/1.0/navigator",children:{geolocation:{path:"w3c/1.0/geolocation"}}},blackberry:{path:"webworks.handset/2.0.0/client/blackberry",children:{pim:{path:"webworks.handset/2.0.0/client/pim",feature:"blackberry.pim.category|blackberry.pim.Task|blackberry.pim.Recurrence|blackberry.pim.Reminder|blackberry.pim.Appointment|blackberry.pim.Address|blackberry.pim.Attendee|blackberry.pim.Memo|blackberry.pim.Contact",children:{category:{path:"webworks.handset/2.0.0/client/category",feature:"blackberry.pim.category"},Task:{path:"webworks.handset/2.0.0/client/Task",feature:"blackberry.pim.Task"},Recurrence:{path:"webworks.handset/2.0.0/client/Recurrence",feature:"blackberry.pim.Recurrence"},Reminder:{path:"webworks.handset/2.0.0/client/Reminder",feature:"blackberry.pim.Reminder"},Appointment:{path:"webworks.handset/2.0.0/client/Appointment",feature:"blackberry.pim.Appointment"},Address:{path:"webworks.handset/2.0.0/client/Address",feature:"blackberry.pim.Address"},Attendee:{path:"webworks.handset/2.0.0/client/Attendee",feature:"blackberry.pim.Attendee"},Memo:{path:"webworks.handset/2.0.0/client/Memo",feature:"blackberry.pim.Memo"},Contact:{path:"webworks.handset/2.0.0/client/Contact",feature:"blackberry.pim.Contact"}}},phone:{children:{Phone:{path:"webworks.handset/2.0.0/client/Phone",feature:"blackberry.phone.Phone"},PhoneLogs:{path:"webworks.handset/2.0.0/client/PhoneLogs",feature:"blackberry.phone.PhoneLogs|blackberry.phone.Find",children:{CallLog:{path:"webworks.handset/2.0.0/client/CallLog"}}},Find:{children:{FilterExpression:{path:"webworks.handset/2.0.0/client/FilterExpression",feature:"blackberry.phone.Find"}}}}},message:{path:"webworks.handset/2.0.0/client/messaging",feature:"blackberry.message.sms|blackberry.message",children:{sms:{path:"webworks.handset/2.0.0/client/sms",feature:"blackberry.message.sms"},Message:{path:"webworks.handset/2.0.0/client/Message",feature:"blackberry.message"}}},transport:{path:"webworks.core/2.0.0/client/transport"},events:{path:"webworks.core/2.0.0/client/events"},app:{path:"webworks.handset/2.0.0/client/app",feature:"blackberry.app",children:{event:{path:"webworks.handset/2.0.0/client/appEvent",feature:"blackberry.app.event"}}},invoke:{path:"webworks.handset/2.0.0/client/invoke",feature:"blackberry.invoke",children:{AddressBookArguments:{path:"webworks.handset/2.0.0/client/AddressBookArguments",feature:"blackberry.invoke.AddressBookArguments"},BrowserArguments:{path:"webworks.handset/2.0.0/client/BrowserArguments",feature:"blackberry.invoke.BrowserArguments"},CameraArguments:{path:"webworks.handset/2.0.0/client/CameraArguments",feature:"blackberry.invoke.CameraArguments"},CalendarArguments:{path:"webworks.handset/2.0.0/client/CalendarArguments",feature:"blackberry.invoke.CalendarArguments"},JavaArguments:{path:"webworks.handset/2.0.0/client/JavaArguments",feature:"blackberry.invoke.JavaArguments"},MapsArguments:{path:"webworks.handset/2.0.0/client/MapsArguments",feature:"blackberry.invoke.MapsArguments"},MemoArguments:{path:"webworks.handset/2.0.0/client/MemoArguments",feature:"blackberry.invoke.MemoArguments"},MessageArguments:{path:"webworks.handset/2.0.0/client/MessageArguments",feature:"blackberry.invoke.MessageArguments"},PhoneArguments:{path:"webworks.handset/2.0.0/client/PhoneArguments",feature:"blackberry.invoke.PhoneArguments"},SearchArguments:{path:"webworks.handset/2.0.0/client/SearchArguments",feature:"blackberry.invoke.SearchArguments"},TaskArguments:{path:"webworks.handset/2.0.0/client/TaskArguments",feature:"blackberry.invoke.TaskArguments"}}},identity:{path:"webworks.handset/2.0.0/client/identity",feature:"blackberry.identity",children:{Transport:{path:"webworks.handset/2.0.0/client/identity/Transport",feature:"blackberry.identity"},Service:{path:"webworks.handset/2.0.0/client/identity/Service",feature:"blackberry.identity"},phone:{path:"webworks.handset/2.0.0/client/identity/phone",feature:"blackberry.identity.phone"}}},system:{path:"webworks.handset/2.0.0/client/system",feature:"blackberry.system",children:{event:{path:"webworks.handset/2.0.0/client/systemEvent",feature:"blackberry.system.event"}}},ui:{children:{dialog:{path:"webworks.core/2.0.0/client/dialog",feature:"blackberry.ui.dialog"},menu:{path:"webworks.handset/2.0.0/client/menu",children:{MenuItem:{path:"webworks.handset/2.0.0/client/MenuItem"}}}}},utils:{path:"webworks.core/2.0.0/client/utils",feature:"blackberry.utils"},find:{feature:"blackberry.find",children:{FilterExpression:{path:"webworks.handset/2.0.0/client/FilterExpression",feature:"blackberry.find"}}},push:{path:"webworks.handset/2.0.0/client/push",feature:"blackberry.push"},audio:{path:"webworks.handset/2.0.0/client/audio",
feature:"blackberry.audio",children:{Player:{path:"webworks.handset/2.0.0/client/AudioPlayer",feature:"blackberry.audio.Player"}}},io:{children:{dir:{path:"webworks.handset/2.0.0/client/io/dir",feature:"blackberry.io.dir"},file:{path:"webworks.core/2.0.0/client/io/file",feature:"blackberry.io.file"}}}}}}}});ripple.define("platform/webworks.tablet/2.0.0/XMLHttpRequest",function(ripple,exports,module){var xhr=ripple("platform/webworks.core/2.0.0/XMLHttpRequest");module.exports=xhr.create("platform/webworks.tablet/2.0.0/server")});ripple.define("platform/webworks.tablet/2.0.0/client/BrowserArguments",function(ripple,exports,module){module.exports=function(url){return{url:url}}});ripple.define("platform/webworks.tablet/2.0.0/client/CameraArguments",function(ripple,exports,module){var _self=function(){return{view:0}};_self.__defineGetter__("VIEW_CAMERA",function(){return 0});_self.__defineGetter__("VIEW_RECORDER",function(){return 1});module.exports=_self});ripple.define("platform/webworks.tablet/2.0.0/client/app",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_uri="blackberry/app/",_self;_self={exit:function(){transport.call(_uri+"exit",{async:true})}};_self.__defineGetter__("author",function(){return transport.call(_uri+"author")});_self.__defineGetter__("authorEmail",function(){return transport.call(_uri+"authorEmail")});_self.__defineGetter__("authorURL",function(){return transport.call(_uri+"authorURL")});_self.__defineGetter__("copyright",function(){return transport.call(_uri+"copyright")});_self.__defineGetter__("description",function(){return transport.call(_uri+"description")});_self.__defineGetter__("id",function(){return transport.call(_uri+"id")});_self.__defineGetter__("license",function(){return transport.call(_uri+"license")});_self.__defineGetter__("licenseURL",function(){return transport.call(_uri+"licenseURL")});_self.__defineGetter__("name",function(){return transport.call(_uri+"name")});_self.__defineGetter__("version",function(){return transport.call(_uri+"version")});module.exports=_self});ripple.define("platform/webworks.tablet/2.0.0/client/appEvent",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_callbacks={},_self;function _poll(evt,handler){_callbacks[evt]=handler;transport.poll("blackberry/app/event/"+evt,{},function(){var func=_callbacks[evt];if(func){func()}return!!func})}_self={onBackground:function(handler){_poll("onBackground",handler)},onForeground:function(handler){_poll("onForeground",handler)},onSwipeDown:function(handler){_poll("onSwipeDown",handler)},onSwipeStart:function(handler){_poll("onSwipeStart",handler)}};module.exports=_self});ripple.define("platform/webworks.tablet/2.0.0/client/identity",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),_uri="blackberry/identity/",_self={};_self.__defineGetter__("PIN",function(){return transport.call(_uri+"PIN")});module.exports=_self});ripple.define("platform/webworks.tablet/2.0.0/client/invoke",function(ripple,exports,module){var _uri="blackberry/invoke/invoke",APP_URL_CAMERA="camera://",APP_URL_CAMERA_VIDEO="camera://video",APP_URL_MAP="map://",APP_URL_MUSIC="music://",APP_URL_PHOTOS="photos://",APP_URL_VIDEOS="videos://",APP_URL_APPWORLD="appworld://",APP_URL_UPDATE="update://",APP_TYPE_ERROR="appType not supported",APP_BROWSER_ERROR="Protocol specified in the url is not supported.",transport=ripple("platform/webworks.core/2.0.0/client/transport"),_self;_self={invoke:function(appType,args){var get={};switch(appType){case 4:if(!args||args.view===1){get.appType=APP_URL_CAMERA_VIDEO}else{get.appType=APP_URL_CAMERA}break;case 5:get.appType=APP_URL_MAP;break;case 11:if(!args){get.appType="http://"}else{get.appType=args.url.split("://");if(get.appType.length===1){get.appType="http://"+get.appType[0]}else if(get.appType.length===2){if(get.appType[0].indexOf("http")!==0){throw APP_BROWSER_ERROR}else{get.appType=args.url}}}break;case 13:get.appType=APP_URL_MUSIC;break;case 14:get.appType=APP_URL_PHOTOS;break;case 15:get.appType=APP_URL_VIDEOS;break;case 16:get.appType=APP_URL_APPWORLD;break;case 17:get.appType=APP_URL_UPDATE;break;default:throw APP_TYPE_ERROR}transport.call(_uri,{get:get,async:true})}};_self.__defineGetter__("APP_CAMERA",function(){return 4});_self.__defineGetter__("APP_MAPS",function(){return 5});_self.__defineGetter__("APP_BROWSER",function(){return 11});_self.__defineGetter__("APP_MUSIC",function(){return 13});_self.__defineGetter__("APP_PHOTOS",function(){return 14});_self.__defineGetter__("APP_VIDEOS",function(){return 15});_self.__defineGetter__("APP_APPWORLD",function(){return 16});module.exports=_self});ripple.define("platform/webworks.tablet/2.0.0/client/io/dir",function(ripple,exports,module){var dir=ripple("platform/webworks.core/2.0.0/client/io/dir"),utils=ripple("utils"),_self={};utils.mixin({appDirs:{app:{storage:{path:"file:///accounts/1000/appdata/emulatedapp/data"}},shared:{bookmarks:{path:"file:///accounts/1000/appdata/emulatedapp/shared/bookmarks"},books:{path:"file:///accounts/1000/appdata/emulatedapp/shared/books"},camera:{path:"file:///accounts/1000/appdata/emulatedapp/shared/camera"},documents:{path:"file:///accounts/1000/appdata/emulatedapp/shared/documents"},downloads:{path:"file:///accounts/1000/appdata/emulatedapp/shared/downloads"},misc:{path:"file:///accounts/1000/appdata/emulatedapp/shared/misc"},music:{path:"file:///accounts/1000/appdata/emulatedapp/shared/music"},photos:{path:"file:///accounts/1000/appdata/emulatedapp/shared/photos"},print:{path:"file:///accounts/1000/appdata/emulatedapp/shared/print"},videos:{path:"file:///accounts/1000/appdata/emulatedapp/shared/videos"},voice:{path:"file:///accounts/1000/appdata/emulatedapp/shared/voice"}}}},_self);utils.mixin(dir,_self);module.exports=_self});ripple.define("platform/webworks.tablet/2.0.0/client/system",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),system=ripple("platform/webworks.core/2.0.0/client/system"),_uri="blackberry/system/";system.__defineGetter__("scriptApiVersion",function(){return transport.call(_uri+"softwareVersion")});module.exports=system});ripple.define("platform/webworks.tablet/2.0.0/client/systemEvent",function(ripple,exports,module){var transport=ripple("platform/webworks.core/2.0.0/client/transport"),api="blackberry/system/event/";function _poll(evt,handler){transport.poll(api+evt,{},function(data){if(handler){handler(data)}return!!handler})}module.exports={deviceBatteryLevelChange:function(handler){_poll("deviceBatteryLevelChange",handler)},deviceBatteryStateChange:function(handler){_poll("deviceBatteryStateChange",handler)}}});ripple.define("platform/webworks.tablet/2.0.0/server/app",function(ripple,exports,module){var event=ripple("event"),app=ripple("app"),_self;_self={event:ripple("platform/webworks.tablet/2.0.0/server/appEvent"),exit:function(){event.trigger("AppExit");return{code:1}},author:function(){return{code:1,data:app.getInfo().author}},authorEmail:function(){return{code:1,data:app.getInfo().authorEmail}},authorURL:function(){return{code:1,data:app.getInfo().authorURL}},copyright:function(){return{code:1,data:app.getInfo().copyright}},description:function(){return{code:1,data:app.getInfo().description}},id:function(){return{code:1,data:app.getInfo().id}},license:function(){return{code:1,data:app.getInfo().license}},licenseURL:function(){return{code:1,data:app.getInfo().licenseURL}},name:function(){return{code:1,data:app.getInfo().name}},version:function(){return{code:1,data:app.getInfo().version}}};module.exports=_self});ripple.define("platform/webworks.tablet/2.0.0/server/appEvent",function(ripple,exports,module){var event=ripple("event"),notifications=ripple("notifications"),_bg,_fg,_swipeDown,_swipeStart,_exit;event.on("AppExit",function(){var baton=_exit;_exit=null;notifications.openNotification("normal","blackberry.app.exit() as called, in the real world your app will exit, here... you get this notification");return baton&&baton.pass({code:1})});event.on("AppRequestBackground",function(){var baton=_bg;_bg=null;return baton&&baton.pass({code:1})});event.on("AppRequestForeground",function(){var baton=_fg;_fg=null;return baton&&baton.pass({code:1})});event.on("AppSwipeDown",function(){var baton=_swipeDown;_swipeDown=null;return baton&&baton.pass({code:1})});event.on("AppSwipeStart",function(){var baton=_swipeStart;_swipeStart=null;return baton&&baton.pass({code:1})});module.exports={onBackground:function(get,post,baton){baton.take();_bg=baton;return{code:1}},onForeground:function(get,post,baton){baton.take();_fg=baton;return{code:1}},onSwipeDown:function(get,post,baton){baton.take();_swipeDown=baton;return{code:1}},onSwipeStart:function(get,post,baton){baton.take();_swipeStart=baton;return{code:1}}}});ripple.define("platform/webworks.tablet/2.0.0/server/identity",function(ripple,exports,module){var deviceSettings=ripple("deviceSettings");module.exports={PIN:function(){return{code:1,data:deviceSettings.retrieve("identity.PIN")}}}});ripple.define("platform/webworks.tablet/2.0.0/server/invoke",function(ripple,exports,module){var notifications=ripple("notifications"),type="normal",name={"camera://":"Camera","camera://video":"Video Camera","map://":"Maps","http://":"Browser","music://":"Music","photos://":"Photos","videos://":"Videos","appworld://":"App World","update://":"Update"};module.exports={invoke:function(opts){var app=name[opts.appType];if(app===undefined&&opts.appType&&opts.appType.match(/^http/i)){app="Browser"}notifications.openNotification(type,"Requested to launch: "+app+" application.");return{code:1}}}});ripple.define("platform/webworks.tablet/2.0.0/server/systemEvent",function(ripple,exports,module){var event=ripple("event"),_onBatteryStateChange,_onBatteryLevelChange,_states={UNKNOWN:0,FULL:1,CHARGING:2,UNPLUGGED:3},_battery={state:_states.UNKNOWN,charging:null,level:null};function _getState(){return _battery.level===100?_states.FULL:_battery.charging?_states.CHARGING:_states.UNPLUGGED}function _pass(baton,data){if(baton){baton.pass({code:1,data:data})}}event.on("DeviceBatteryStateChanged",function(charging){_battery.charging=charging;_battery.state=_getState();_pass(_onBatteryStateChange,_battery.state)});event.on("DeviceBatteryLevelChanged",function(level){level=parseInt(level,10);_battery.level=level;_pass(_onBatteryLevelChange,level);if(level===100){_battery.state=_getState();_pass(_onBatteryStateChange,_battery.state)}});module.exports={deviceBatteryLevelChange:function(get,post,baton){baton.take();_onBatteryLevelChange=baton},deviceBatteryStateChange:function(get,post,baton){baton.take();_onBatteryStateChange=baton}}});ripple.define("platform/webworks.tablet/2.0.0/server",function(ripple,exports,module){var utils=ripple("utils"),platform="platform/webworks.tablet/2.0.0/server/",core="platform/webworks.core/2.0.0/server/",systemEvent=ripple(platform+"systemEvent"),system={};system.event=systemEvent;utils.mixin(ripple(core+"system"),system);module.exports={blackberry:{identity:ripple(platform+"identity"),app:ripple(platform+"app"),invoke:ripple(platform+"invoke"),system:system,ui:{dialog:ripple(core+"dialog")},io:{dir:ripple(core+"io/dir"),file:ripple(core+"io/file")}}}});ripple.define("platform/webworks.tablet/2.0.0/spec/device",function(ripple,exports,module){var event=ripple("event");module.exports={transports:{TCPCellular:{name:"Cellular TCP",control:{type:"checkbox",value:true}},WAP:{name:"WAP",control:{type:"checkbox",value:false}},WAP2:{name:"WAP 2.0",control:{type:"checkbox",value:false}},MDS:{name:"MDS",control:{type:"checkbox",value:true}},BISB:{name:"BIS B",control:{type:"checkbox",value:true}},Unite:{name:"Unite!",control:{type:"checkbox",value:false}},TCPWifi:{name:"Wifi TCP",control:{type:"checkbox",value:true}}},identity:{PIN:{name:"PIN",control:{type:"text",value:"43A8C489"}}},battery:{state:{name:"Handset is Charging",control:{type:"checkbox",value:true},callback:function(setting){event.trigger("DeviceBatteryStateChanged",[setting])}},level:{name:"Charge Level (% remaining)",control:{type:"select",value:100},options:function(){var i,optionList={};for(i=0;i<=100;i++){optionList[i]=i}return optionList}(),callback:function(setting){event.trigger("DeviceBatteryLevelChanged",[setting])}}},system:{isMassStorageActive:{name:"Mass Storage Is Connected",control:{type:"checkbox",value:true}},hasDataCoverage:{name:"Has Data Coverage",control:{type:"checkbox",value:true},callback:function(setting){event.trigger("CoverageChange");ripple("bus").send("network",setting)}},lag:{name:"Lag the network",control:{type:"checkbox",value:false},callback:function(setting){ripple("bus").send("lag",setting)}},network:{name:"Data Network",control:{type:"select",value:"3GPP"},options:{"3GPP":"3GPP",CDMA:"CDMA",iDEN:"iDEN","Wi-Fi":"Wi-Fi"},callback:function(){event.trigger("CoverageChange")}}}}});ripple.define("platform/webworks.tablet/2.0.0/spec/events",function(ripple,exports,module){var _self,utils=ripple("utils"),event=ripple("event"),events=ripple("platform/webworks.core/2.0.0/spec/events");_self={"app.event.onSwipeDown":{callback:function(){event.trigger("AppSwipeDown")}},"app.event.onSwipeStart":{callback:function(){event.trigger("AppSwipeStart")}}};utils.mixin(events,_self);module.exports=_self});ripple.define("platform/webworks.tablet/2.0.0/spec/ui",function(ripple,exports,module){module.exports={plugins:["accelerometer","deviceSettings","geoView","platformEvents","widgetConfig","build"]}});ripple.define("platform/webworks.tablet/2.0.0/spec",function(ripple,exports,module){module.exports={id:"webworks.tablet",version:"2.0.0",name:"WebWorks-TabletOS",persistencePrefix:"rim-tablet-",ui:ripple("platform/webworks.tablet/2.0.0/spec/ui"),device:ripple("platform/webworks.tablet/2.0.0/spec/device"),config:ripple("platform/webworks.core/2.0.0/spec/config"),events:ripple("platform/webworks.tablet/2.0.0/spec/events"),initialize:function(){ripple("platform/webworks.core/2.0.0/fsCache");ripple("platform/webworks.core/2.0.0/fs").initialize()},objects:{XMLHttpRequest:{path:"webworks.tablet/2.0.0/XMLHttpRequest"},Coordinates:{path:"w3c/1.0/Coordinates"},Position:{path:"w3c/1.0/Position"},PositionError:{path:"w3c/1.0/PositionError"},navigator:{path:"w3c/1.0/navigator",children:{geolocation:{path:"w3c/1.0/geolocation"}}},blackberry:{children:{transport:{path:"webworks.core/2.0.0/client/transport"},events:{path:"webworks.core/2.0.0/client/events"},app:{path:"webworks.tablet/2.0.0/client/app",feature:"blackberry.app",children:{event:{path:"webworks.tablet/2.0.0/client/appEvent",feature:"blackberry.app.event"}}},invoke:{path:"webworks.tablet/2.0.0/client/invoke",feature:"blackberry.invoke",children:{BrowserArguments:{path:"webworks.tablet/2.0.0/client/BrowserArguments",feature:"blackberry.invoke.BrowserArguments"},CameraArguments:{path:"webworks.tablet/2.0.0/client/CameraArguments",feature:"blackberry.invoke.CameraArguments"}}},identity:{path:"webworks.tablet/2.0.0/client/identity",feature:"blackberry.identity"},system:{path:"webworks.tablet/2.0.0/client/system",children:{event:{path:"webworks.tablet/2.0.0/client/systemEvent"}}},ui:{children:{dialog:{path:"webworks.core/2.0.0/client/dialog",feature:"blackberry.ui.dialog"}}},utils:{path:"webworks.core/2.0.0/client/utils",feature:"blackberry.utils"},io:{children:{dir:{path:"webworks.tablet/2.0.0/client/io/dir",feature:"blackberry.io.dir"},file:{path:"webworks.core/2.0.0/client/io/file",feature:"blackberry.io.file"}}}}}}}});ripple.define("platform",function(ripple,exports,module){var _current,db=ripple("db"),utils=ripple("utils"),_console=ripple("console"),app=ripple("app"),event=ripple("event"),spec=ripple("platform/spec"),_self;function _getRequestedPlatform(){var requestedPlatform=null,enableRippleArg=utils.queryString().enableripple,platform;if(enableRippleArg){enableRippleArg=enableRippleArg.split("-");platform=spec.get(enableRippleArg[0],enableRippleArg[1]);if(platform){requestedPlatform={name:platform.id,version:platform.version}}}return requestedPlatform}function _validatePlatform(platform){return!(!platform||!spec[platform.name]||!spec[platform.name][platform.version]||spec[platform.name][platform.version]&&!spec[platform.name][platform.version].objects)}function firstAvailablePlatform(){return utils.map(_self.getList(),function(platform){return utils.map(platform,function(details,version){return{name:details.id,version:version}})[0]})[0]}function _getPlatform(){return ripple("platform/"+_current.name+"/"+_current.version+"/spec")}_self={initialize:function(){_current=_getRequestedPlatform()||db.retrieveObject("api-key");if(_validatePlatform(_current)){db.saveObject("api-key",_current)}else{_current=firstAvailablePlatform()}_console.prefix=_current.name},getList:function(){var platformList={};utils.forEach(spec,function(platform,platformKey){utils.forEach(platform,function(version,versionKey){platformList[platformKey]=platformList[platformKey]||{};platformList[platformKey][versionKey]={id:version.id,name:version.name,type:version.type}})});return platformList},getPersistencePrefix:function(id){return _getPlatform().persistencePrefix+(id||app.getInfo().id)+"-"},current:function(){return _getPlatform()},changeEnvironment:function(platform,deviceId,callback){var save=jWorkflow.order(function(prev,baton){baton.take();db.saveObject("api-key",platform,null,baton.pass)}).andThen(function(prev,baton){baton.take();db.save("device-key",deviceId,null,baton.pass)}).andThen(function(prev,baton){baton.take();db.save("layout",null,null,baton.pass)}).andThen(function(){event.trigger("PlatformChangedEvent",[],true);_console.prefix=null;_console.log("Emulator :: loading platform "+platform.name)});save.start(callback)}};module.exports=_self});ripple.define("resizer",function(ripple,exports,module){var db=ripple("db"),exception=ripple("exception"),utils=ripple("utils"),devices=ripple("devices"),constants=ripple("constants"),event=ripple("event"),_win,_doc,_self;function _validateLayoutType(layoutType){return layoutType==="landscape"||layoutType==="portrait"}function _getContainers(){return{device:{div:document.getElementById("device-container"),containerClass:document.getElementById("device-container").getAttribute("class")||""},viewport:{div:document.getElementById("viewport-container"),containerClass:document.getElementById("viewport-container").getAttribute("class")||""},"menu-button":{div:document.getElementById(constants.COMMON.MENU_BUTTON),containerClass:document.getElementById(constants.COMMON.MENU_BUTTON).getAttribute("class")||""},"back-button":{div:document.getElementById(constants.COMMON.BACK_BUTTON),containerClass:document.getElementById(constants.COMMON.BACK_BUTTON).getAttribute("class")||""}}}function _setContainers(containers,device,orientation){var removalSuffix=orientation==="portrait"?"landscape":"portrait",suffix={portrait:"-wrapper"+(device.skin?"-"+device.skin:""),landscape:"-wrapper-landscape"+(device.skin?"-"+device.skin:"")};utils.forEach(containers,function(container,key){container.div.setAttribute("class",container.containerClass.replace(" "+key+suffix[removalSuffix],"")+" "+key+suffix[orientation])})}function _getDimensions(device,orientation){var cssPixelRatio=device.mediaQueryEmulation&&device.mediaQueryEmulation["-webkit-device-pixel-ratio"]?device.mediaQueryEmulation["-webkit-device-pixel-ratio"]:1;return{cssPixelRatio:cssPixelRatio,deviceWidth:Math.floor((orientation==="portrait"?device.screen.width:device.screen.height)/cssPixelRatio),deviceHeight:Math.floor((orientation==="portrait"?device.screen.height:device.screen.width)/cssPixelRatio),paddingLeft:device.viewPort[orientation].paddingLeft,paddingTop:device.viewPort[orientation].paddingTop,viewPort:{width:Math.floor(device.viewPort[orientation].width/cssPixelRatio),height:Math.floor(device.viewPort[orientation].height/cssPixelRatio)}}}function sizeDevice(containers,dimensions){containers.device.div.style.width=dimensions.deviceWidth+4+"px";containers.device.div.style.height=dimensions.deviceHeight+4+"px";containers.viewport.div.style.width=dimensions.viewPort.width+"px";containers.viewport.div.style.height=dimensions.viewPort.height+"px";containers.viewport.div.style.padding=dimensions.paddingTop+"px "+(dimensions.deviceWidth-(dimensions.viewPort.width+dimensions.paddingLeft))+"px "+(dimensions.deviceHeight-(dimensions.viewPort.height+dimensions.paddingTop))+"px "+dimensions.paddingLeft+"px"}function _setOrientation(layout){_win.orientation=window.orientation=layout==="portrait"?0:90}_self={init:function(win,doc){_win=win;_doc=doc;var layout=db.retrieve("layout")||"portrait";_setOrientation(layout);_win.onorientationchange=undefined;_win.devicePixelRatio=window.devicePixelRatio},resize:function(device){var layout=db.retrieve("layout"),orientation="portrait",containers,dimensions;if(layout&&layout==="landscape"&&device.viewPort.landscape){orientation="landscape"}containers=_getContainers();_setContainers(containers,device,orientation);dimensions=_getDimensions(device,orientation);sizeDevice(containers,dimensions);window.devicePixelRatio=dimensions.cssPixelRatio;event.trigger("ScreenChangeDimensions",[dimensions.viewPort.width,dimensions.viewPort.height])},changeLayoutType:function(layoutType){if(!_validateLayoutType(layoutType)){exception.raise(exception.types.LayoutType,"unknown layout type requested!")}db.save("layout",layoutType);_self.resize(devices.getCurrentDevice());if(!_win)return;_setOrientation(layoutType);if(_win.onorientationchange){_win.onorientationchange()}var evt=_doc.createEvent("Event");evt.initEvent("orientationchange",true,true);_win.dispatchEvent(evt)}};module.exports=_self});ripple.define("touchEventEmulator",function(ripple,exports,module){var utils=ripple("utils"),_lastMouseEvent,_isMouseDown,_win,_doc,_longPressTimer,_longPressDuration=450,self;function _initTouchEvent(type,canBubble,cancelable,eventData){var touchEvent=_doc.createEvent("Event");touchEvent.initEvent(type,canBubble,cancelable);utils.mixin(eventData,touchEvent);return touchEvent}function _simulateTouchEvent(type,mouseevent){var simulatedEvent,touchObj,eventData;if(_lastMouseEvent&&mouseevent.type===_lastMouseEvent.type&&mouseevent.pageX===_lastMouseEvent.pageX&&mouseevent.pageY===_lastMouseEvent.pageY)return;_lastMouseEvent=mouseevent;touchObj={clientX:mouseevent.pageX,clientY:mouseevent.pageY,identifier:"",pageX:mouseevent.pageX,pageY:mouseevent.pageY,screenX:mouseevent.pageX,screenY:mouseevent.pageY,target:mouseevent.target};eventData={altKey:mouseevent.altKey,ctrlKey:mouseevent.ctrlKey,shiftKey:mouseevent.shiftKey,metaKey:mouseevent.metaKey,changedTouches:[touchObj],targetTouches:type==="touchend"?[]:[touchObj],touches:type==="touchend"?[]:[touchObj]};utils.mixin(touchObj,eventData);var itemFn=function(index){return this[index]};eventData.touches.item=itemFn;eventData.changedTouches.item=itemFn;eventData.targetTouches.item=itemFn;simulatedEvent=_initTouchEvent(type,true,true,eventData);mouseevent.target.dispatchEvent(simulatedEvent);if(typeof mouseevent.target["on"+type]==="function"){mouseevent.target["on"+type].apply(mouseevent.target,[simulatedEvent])}}function _translateMouseEvent(mouseevent){var type="";switch(mouseevent.type){case"mousedown":type="touchstart";_isMouseDown=true;clearTimeout(_longPressTimer);_longPressTimer=setTimeout(function(){},_longPressDuration);break;case"mousemove":if(!_isMouseDown){return}type="touchmove";break;case"mouseup":type="touchend";_isMouseDown=false;clearTimeout(_longPressTimer);break;default:return}_simulateTouchEvent(type,mouseevent)}function _marshalEvents(win,doc){utils.forEach(["mousedown","mousemove","mouseup"],function(event){doc.addEventListener(event,_translateMouseEvent,true)});_doc=doc;_win=win;win.Node.prototype.ontouchstart=null;win.Node.prototype.ontouchend=null;win.Node.prototype.ontouchmove=null}self=module.exports={init:function(win,doc,longPressDuration){if(typeof longPressDuration!=="undefined"&&parseInt(longPressDuration,10)===longPressDuration){_longPressDuration=longPressDuration}_marshalEvents(win,doc)}}});ripple.define("ui/plugins/about-dialog",function(ripple,exports,module){var bus=ripple("bus");module.exports={initialize:function(){$("#about-dialog").dialog({autoOpen:false,position:"center",minWidth:"400"})},show:function(){var port="9910";bus.send("version",null,function(resp){$("#about-dialog-ripple-ui-version").html("(v"+resp.version+")")});bus.ajax("GET","http://127.0.0.1:"+port+"/ripple/about",null,function(resp){$("#about-dialog-ripple-build-deploy-version").html("(v"+resp.data.version+")")},function(error){var version=error.data;if(error.code===0||error.code===404){version="The service is not running"}$("#about-dialog-ripple-build-deploy-version").html("("+version+")")});$("#about-dialog").dialog("open")}}});ripple.define("ui/plugins/accelerometer",function(ripple,exports,module){var goodVibrations=ripple("ui/plugins/goodVibrations"),accelerometer=ripple("accelerometer"),event=ripple("event"),Rotation=ripple("platform/w3c/1.0/Rotation"),Acceleration=ripple("platform/w3c/1.0/Acceleration"),_mouseDown,_shiftKeyDown,_offsets={x:0,y:0,z:-9.81},_oldX,_oldY,_oldAlphaX,_deltaAlpha,_x,_y,_z,_alpha,_beta,_gamma,_shape="-30,30,10, 30,30,10, 30,60,10, 100,100,100,-1,0;"+"-30,30,10, 30,60,10, -30,60,10, 100,100,100,-1,0;"+"-20,-50,11, 20,-50,11, 20,20,11, 100,100,100,-1,0;"+"-20,-50,11, 20,20,11, -20,20,11, 100,100,100,-1,0;"+"-30,30,10, 30,20,10, 30,30,10, 0,0,0,-1,0;"+"-30,30,10, -30,20,10, 30,20,10, 0,0,0,-1,0;"+"-30,-60,10, 30,-60,10, 30,-50,10, 0,0,0,-1,0;"+"-30,-60,10, 30,-50,10, -30,-50,10, 0,0,0,-1,0;"+"-30,-50,10, -20,-50,10, -20,20,10, 0,0,0,-1,0;"+"-30,-50,10, -20,20,10, -30,20,10, 0,0,0,-1,0;"+"20,-50,10, 30,-50,10, 30,20,10, 0,0,0,-1,0;"+"20,-50,10, 30,20,10, 20,20,10, 0,0,0,-1,0;"+"-30,-60,-10, 30,60,-10, 30,-60,-10, 0,0,0,-1,0;"+"-30,-60,-10, -30,60,-10, 30,60,-10, 0,00,-1,0;"+"30,-60,-10, 30,60,-10, 30,60,10, 50,50,80,-1,0;"+"30,-60,-10, 30,60,10, 30,-60,10, 50,50,80,-1,0;"+"-30,-60,-10, -30,60,10, -30,60,-10, 50,50,80,-1,0;"+"-30,-60,-10, -30,-60,10, -30,60,10, 50,50,80,-1,0;"+"30,-60,-10, -30,-60,10, -30,-60,-10, 50,80,50,-1,0;"+"30,-60,-10, 30,-60,10, -30,-60,10, 50,80,50,-1,0;"+"30,60,-10, -30,60,-10, -30,60,10, 80,50,50,-1,0;"+"30,60,-10, -30,60,10, 30,60,10, 80,50,50,-1,0";function _shakeDevice(){window.setTimeout(goodVibrations.shakeDevice(8),1);accelerometer.shake()}function _updateAccelerometerPanel(motion){jQuery("#accelerometer-x").html(Math.round(motion.accelerationIncludingGravity.x*100)/100);jQuery("#accelerometer-y").html(Math.round(motion.accelerationIncludingGravity.y*100)/100);jQuery("#accelerometer-z").html(Math.round(motion.accelerationIncludingGravity.z*100)/100);jQuery("#accelerometer-alpha").html(Math.round(motion.orientation.alpha));jQuery("#accelerometer-beta").html(Math.round(motion.orientation.beta));jQuery("#accelerometer-gamma").html(Math.round(motion.orientation.gamma))}function _updateCanvas(a,b,g){ThreeDee.loadMesh(_shape);g=g||0;ThreeDee.rotate(0,g,0);ThreeDee.rotate(b,0,a);ThreeDee.backface();ThreeDee.shade();ThreeDee.zSort();Draw.initialize(document.querySelector("#accelerometer-canvas"));Draw.clear(0,0,480,300);Draw.drawScene(ThreeDee.getTranslation(),3)}function _createCanvas(){var node=document.querySelector("#accelerometer-canvas"),cosX,sinX,cosY,sinY;ThreeDee.setCenter(150,100);ThreeDee.setLight(-300,-300,800);node.addEventListener("mousemove",function(e){if(_mouseDown&&!_shiftKeyDown){_offsets.x=(_offsets.x+_oldX-e.offsetX)%360;_offsets.y=(_offsets.y+_oldY-e.offsetY)%360;_alpha=_alpha||0;_gamma=-_offsets.x;if(_gamma<-90){_gamma=-90}if(_gamma>90){_gamma=90}_beta=-_offsets.y%360;if(_beta<-180){_beta+=360}else if(_beta>=180){_beta-=360}cosX=Math.cos(_gamma*(Math.PI/180));sinX=Math.sin(_gamma*(Math.PI/180));cosY=Math.cos(_beta*(Math.PI/180));sinY=Math.sin(_beta*(Math.PI/180));_x=9.81*cosY*sinX;_y=-9.81*sinY;_z=-9.81*cosY*cosX}else if(_mouseDown&&_shiftKeyDown){_deltaAlpha=(_deltaAlpha-(_oldAlphaX-e.offsetX)*2.5)%360;_alpha=(360-_deltaAlpha)%360}_oldX=e.offsetX;_oldY=e.offsetY;_oldAlphaX=e.offsetX;_updateCanvas(_deltaAlpha,-_beta,_gamma);accelerometer.setInfo({x:_x,y:_y,z:_z,alpha:_alpha,beta:_beta,gamma:_gamma})});node.addEventListener("mousedown",function(e){_oldX=e.offsetX;_oldY=e.offsetY;_mouseDown=true});node.addEventListener("mouseup",function(){_mouseDown=false});document.addEventListener("mouseup",function(){_mouseDown=false});document.addEventListener("keydown",function(e){if(e.keyCode===16){_oldAlphaX=_oldX;_shiftKeyDown=true}});document.addEventListener("keyup",function(e){if(e.keyCode===16){_shiftKeyDown=false}});return node}function _initCreate(){var node=_createCanvas();jQuery(node).bind("dblclick",function(){_resetAccelerometer()});_resetAccelerometer()}function _resetAccelerometer(){_alpha=0;_beta=0;_gamma=0;_x=0;_y=0;_z=-9.81;_deltaAlpha=360;_updateCanvas(0,0);_oldX=0;_oldY=0;_oldAlphaX=0;_offsets={x:0,y:0,z:-9.81};accelerometer.setInfo({acceleration:new Acceleration(0,0,0),accelerationIncludingGravity:new Acceleration(0,0,-9.81),rotationRate:new Rotation(0,0,0),orientation:new Rotation(0,0,0),timestamp:(new Date).getTime()})}module.exports={panel:{domId:"accelerometer-container",collapsed:true,pane:"left"},initialize:function(){_initCreate();_updateAccelerometerPanel(accelerometer.getInfo());jQuery("#accelerometer-shake").click(_shakeDevice);event.on("AccelerometerInfoChangedEvent",_updateAccelerometerPanel,this)}}});ripple.define("ui/plugins/batteryStatus",function(ripple,exports,module){var constants=ripple("constants"),db=ripple("db"),lastLevel,batteryLevel=document.getElementById(constants.BATTERY_STATUS.LEVEL_VALUE),batteryLevelLabel=document.getElementById(constants.BATTERY_STATUS.LEVEL_LABEL),isPlugged=document.getElementById(constants.BATTERY_STATUS.IS_PLUGGED_CHECKBOX);function _getCurrentStatus(){var status={level:batteryLevel.value,isPlugged:isPlugged.checked};return status}function _saveStatus(status){if(status){db.save(constants.BATTERY_STATUS.BATTERY_STATUS_KEY,status.level);db.save(constants.BATTERY_STATUS.IS_PLUGGED_KEY,status.isPlugged);lastLevel=status.level}}function _updateUI(status){if(status){batteryLevel.value=status.level;batteryLevelLabel.innerHTML=status.level+" %";isPlugged.checked=status.isPlugged}}function _fireBatteryEvent(status,previousLevel){var win=ripple("emulatorBridge").window();if(win&&win.cordova){win.cordova.fireWindowEvent("batterystatus",status);var newLevel=parseInt(status.level);var oldLevel=parseInt(previousLevel);if(oldLevel>5&&newLevel<=5){win.cordova.fireWindowEvent("batterycritical",status)}else if(oldLevel>20&&newLevel<=20){win.cordova.fireWindowEvent("batterylow",status)}}}function _processStatusChanged(){var status=_getCurrentStatus();var previousLevel=lastLevel;_saveStatus(status);_updateUI(status);_fireBatteryEvent(status,previousLevel)}module.exports={panel:{domId:"battery-status-container",collapsed:true,pane:"left"},initialize:function(){jQuery("#"+constants.BATTERY_STATUS.LEVEL_VALUE).unbind("mouseup").bind("mouseup",_processStatusChanged);jQuery("#"+constants.BATTERY_STATUS.IS_PLUGGED_CHECKBOX).unbind("click").bind("click",_processStatusChanged);var status={level:db.retrieve(constants.BATTERY_STATUS.BATTERY_STATUS_KEY)||100,isPlugged:db.retrieve(constants.BATTERY_STATUS.IS_PLUGGED_KEY)||false};lastLevel=status.level;_updateUI(status)}}});ripple.define("ui/plugins/browser",function(ripple,exports,module){var ui=ripple("ui"),event=ripple("event"),_url=document.getElementById("browser-url"),_target=document.getElementById("browser-target"),_options=document.getElementById("browser-options"),_injectJS=document.getElementById("browser-inject-js"),_injectJSHeader=document.getElementById("browser-inject-js-header"),_injectCSS=document.getElementById("browser-inject-css"),_injectCSSHeader=document.getElementById("browser-inject-css-header"),_close=document.getElementById("browser-close"),_self={
initialize:function(){_close.addEventListener("click",_self.hide);_injectJSHeader.style.display="none";_injectCSSHeader.style.display="none"},show:function(url,target,options){_url.innerHTML=url;_target.innerHTML=target;_options.innerHTML=JSON.stringify(options);ui.showOverlay("inappbrowser")},hide:function(){ui.hideOverlay("inappbrowser");event.trigger("browser-close")},injectScript:function(script){_injectJSHeader.style.display="block";_injectJS.innerHTML=script},injectCSS:function(css){_injectCSSHeader.style.display="block";_injectCSS.innerHTML=css}};module.exports=_self});ripple.define("ui/plugins/build",function(ripple,exports,module){var tooltip=ripple("ui/plugins/tooltip"),settings=ripple("ui/plugins/settings-dialog"),bus=ripple("bus");function handleBuild(){var node=$(this),action=node.attr("id").split("-")[2];if(node.hasClass("not-ready")){return}if(!settings.can(action)){settings.show(action)}else{settings.perform(action)}}function areServicesRunning(success,fail){bus.ajax("GET","http://127.0.0.1:9910/ripple/about",null,function(){success()},function(){fail()})}function manageServices(action,callBack){bus.send("services",action,function(){if(typeof callBack==="function"){callBack()}})}module.exports={panel:{domId:"build-container",collapsed:true,pane:"right"},initialize:function(){$("#options-menu-build").click(handleBuild);$("#options-menu-sign").click(handleBuild);$("#options-menu-launch").click(handleBuild);$("#options-menu-start-service").click(function(){manageServices("start",function(){$("#options-menu-services-stop").show();$("#options-menu-services-start").hide()})});$("#options-menu-stop-service").click(function(){manageServices("stop",function(){$("#options-menu-services-stop").hide();$("#options-menu-services-start").show()})});$("#options-menu-settings").click(function(){settings.show()});if(settings.value("remoteInspector")){$("#options-menu-build-warning").show();tooltip.create("#options-menu-build-warning","Remote Web Inspector should be disabled when packaging for App World release")}areServicesRunning(function(){$("#options-menu-services-stop").show();$("#options-menu-services-start").hide()},function(){$("#options-menu-services-stop").hide();$("#options-menu-services-start").show()})}}});ripple.define("ui/plugins/camera",function(ripple,exports,module){var ui=ripple("ui"),event=ripple("event"),upload=document.getElementById("file-upload"),select=document.getElementById("select-file"),take=document.getElementById("take-file"),optOut=document.getElementById("camera-cancel"),result=document.getElementById("camera-result");function getType(){return(upload.getAttribute("accept")||"").replace("/*","")}function clear(){while(result.firstChild){result.removeChild(result.firstChild)}}module.exports={initialize:function(){select.addEventListener("click",function(){upload.click()});upload.addEventListener("change",function(){clear();var captureElementForType={image:"img",audio:"audio",video:"video"};var captureType=getType();var captureElementName=captureElementForType[captureType]||captureType;var capture=document.createElement(captureElementName);capture.setAttribute("controls",true);capture.style.display="inline";capture.style.height=screen.availHeight-50+"px";capture.src=(window.URL||window.webkitURL).createObjectURL(upload.files[0]);result.appendChild(capture);take.style.display="inline"});take.addEventListener("click",function(){event.trigger("captured-"+getType(),[result.firstChild.src,upload.files[0]]);module.exports.hide()});optOut.addEventListener("click",function(){console.log("capture-image cancelled");event.trigger("image-capture-cancelled");ui.hideOverlay("camera-window")})},show:function(type){type=type||"image";ui.showOverlay("camera-window");if(getType()!==type){clear()}upload.setAttribute("accept",type+"/*");if(result.firstChild&&result.firstChild.src){take.style.display="inline"}else{take.style.display="none"}event.trigger("camera-opened")},hide:function(){if(result.firstChild&&result.firstChild.pause){result.firstChild.pause()}ui.hideOverlay("camera-window");event.trigger("camera-closed")}}});ripple.define("ui/plugins/context-menu",function(ripple,exports,module){var MAX_NUM_ITEMS_IN_PORTRAIT_PEEK_MODE=7,event=ripple("event"),MAX_NUM_ITEMS_IN_LANDSCAPE_PEEK_MODE=3,PEEK_MODE_TRANSLATE_X=-121,FULL_MENU_TRANSLATE_X=-569,HIDDEN_MENU_TRANSLATE_X=0,MENU_ITEM_HEIGHT=121,state={HIDE:0,PEEK:1,VISIBLE:2,DRAGEND:3},maxNumItemsInPeekMode=MAX_NUM_ITEMS_IN_PORTRAIT_PEEK_MODE,menuCurrentState=state.HIDE,touchMovedOnMenu=false,touchMovedOnBody=false,numItems=0,peekModeNumItems=0,dragStartPoint,currentTranslateX,menu,contextMenuContent,contextMenuHandle,contextMenuDelete,headText,subheadText,currentPeekIndex,previousPeekIndex,elements,modal,menuPageY,isMouseDown=false,self;function getMenuXTranslation(){if(menuCurrentState===state.PEEK){return PEEK_MODE_TRANSLATE_X}if(menuCurrentState===state.VISIBLE){return FULL_MENU_TRANSLATE_X}return HIDDEN_MENU_TRANSLATE_X}function positionHandle(){var moreIcon=document.getElementById("moreHandleIcon"),top;if(menuCurrentState===state.PEEK){contextMenuHandle.className="showContextMenuHandle";top=(window.screen.availHeight+(peekModeNumItems-1)*MENU_ITEM_HEIGHT)/2;contextMenuHandle.style.top=top+"px";if(numItems>maxNumItemsInPeekMode){contextMenuContent.style.top="-75px";if(moreIcon===null){moreIcon=document.createElement("img");moreIcon.id="moreHandleIcon";moreIcon.style="showMoreHandleIcon";moreIcon.src=jQuery("#extension-url").text()+"images/webworks/bb10/ActionOverflowMenu.png";moreIcon.className="showMoreHandleIcon";contextMenuHandle.appendChild(moreIcon)}}else{contextMenuContent.style.top="";if(numItems<=maxNumItemsInPeekMode&&moreIcon!==null){contextMenuHandle.removeChild(moreIcon)}}}else if(menuCurrentState===state.VISIBLE){if(numItems<=maxNumItemsInPeekMode){contextMenuContent.style.top="";contextMenuHandle.className="showContextMenuHandle";top=(window.screen.availHeight+(numItems-1)*MENU_ITEM_HEIGHT)/2;contextMenuHandle.style.top=top+"px"}else{contextMenuHandle.className="hideContextMenuHandle"}}}function menuDragStart(){menu.style.webkitTransitionDuration="0s";menu.style.overflowX="hidden";menu.style.overflowY="scroll"}function menuDragMove(pageX){var x=window.screen.width+getMenuXTranslation()+pageX-dragStartPoint,menuWidth=-FULL_MENU_TRANSLATE_X;if(x>=window.screen.width-menuWidth){currentTranslateX=getMenuXTranslation()+pageX-dragStartPoint;menu.style.webkitTransform="translate("+currentTranslateX+"px"+", 0)"}}function menuDragEnd(){menu.style.webkitTransitionDuration="0.25s";menuCurrentState=state.DRAGEND;if(currentTranslateX>PEEK_MODE_TRANSLATE_X){self.hideContextMenu()}else if(currentTranslateX<FULL_MENU_TRANSLATE_X/2){self.showContextMenu()}else{self.peekContextMenu()}menu.style.webkitTransform=""}function menuTouchStartHandler(evt){isMouseDown=true;evt.stopPropagation();menuDragStart();dragStartPoint=evt.pageX}function bodyTouchStartHandler(evt){isMouseDown=true;dragStartPoint=evt.pageX;menuDragStart()}function getMenuItemAtPosition(evt){var touchedElement=document.elementFromPoint(evt.clientX,evt.clientY),index;if(!touchedElement.classList.contains("contextmenuItem")){if(touchedElement.tagName.toUpperCase()==="IMG"&&touchedElement.parentElement.classList.contains("contextmenuItem")){touchedElement=touchedElement.parentElement}else{return-1}}if(!Array.isArray(elements)){elements=Array.prototype.slice.call(elements,0)}index=elements.indexOf(touchedElement);return index}function menuTouchMoveHandler(evt){var currentPeekIndex,i;evt.stopPropagation();currentPeekIndex=getMenuItemAtPosition(evt);if(currentPeekIndex<0){for(i=0;i<elements.length;i+=1){elements[i].className="contextmenuItem";elements[i].active=false}}if(!isMouseDown){return}touchMovedOnMenu=true;menuDragMove(evt.pageX)}function bodyTouchMoveHandler(evt){if(!isMouseDown){return}touchMovedOnBody=true;menuDragMove(evt.pageX)}function menuTouchEndHandler(evt){isMouseDown=false;evt.stopPropagation();if(touchMovedOnMenu){touchMovedOnMenu=false;menuDragEnd()}else{if(menuCurrentState===state.PEEK){self.showContextMenu()}else if(menuCurrentState===state.VISIBLE){self.peekContextMenu()}}}function bodyTouchEndHandler(){isMouseDown=false;if(touchMovedOnBody){touchMovedOnBody=false;menuDragEnd()}else{self.hideContextMenu()}}function highlightMenuItem(item){if(menuCurrentState===state.PEEK){item.className="contextmenuItem showContextmenuItem";item.active=true}else if(menuCurrentState===state.VISIBLE){item.className="contextmenuItem fullContextmenuItem";item.active=true}}function menuItemTouchStartHandler(evt){isMouseDown=true;evt.stopPropagation();highlightMenuItem(evt.currentTarget);previousPeekIndex=currentPeekIndex=evt.currentTarget.index}function menuItemTouchMoveHandler(evt){evt.stopPropagation();var previousPeek=elements[previousPeekIndex];currentPeekIndex=getMenuItemAtPosition(evt);if(currentPeekIndex===previousPeekIndex){return}if(currentPeekIndex===-1){if(previousPeek&&previousPeek.active){previousPeek.className="contextmenuItem";previousPeek.active=false}}else if(previousPeekIndex===-1){highlightMenuItem(elements[currentPeekIndex])}else{if(previousPeek&&previousPeek.active){previousPeek.className="contextmenuItem";previousPeek.active=false}highlightMenuItem(elements[currentPeekIndex])}previousPeekIndex=currentPeekIndex}function menuItemTouchEndHandler(evt){isMouseDown=false;evt.stopPropagation();if(currentPeekIndex!==-1){var element=elements[currentPeekIndex];if(element){element.className="contextmenuItem";element.active=false}event.trigger("contextmenu.executeMenuAction",[element.attributes.actionId.value]);self.hideContextMenu()}}function rotationHandler(){if(window.orientation===0||window.orientation===180){maxNumItemsInPeekMode=MAX_NUM_ITEMS_IN_PORTRAIT_PEEK_MODE}else{maxNumItemsInPeekMode=MAX_NUM_ITEMS_IN_LANDSCAPE_PEEK_MODE}}function handleMouseDown(evt){evt.preventDefault();evt.stopPropagation()}function setHeadText(text){var headTextElement=document.getElementById("contextMenuHeadText");headTextElement.innerHTML=text;if(text){if(!subheadText||subheadText===""){headTextElement.style.height="105px";headTextElement.style.lineHeight="105px"}else{headTextElement.style.height="60px";headTextElement.style.lineHeight="60px"}}else{headTextElement.style.height="0px"}}function setSubheadText(text){var subheadTextElement=document.getElementById("contextMenuSubheadText");subheadTextElement.innerHTML=text;if(text){if(!headText||headText===""){subheadTextElement.style.height="105px";subheadTextElement.style.lineHeight="105px"}else{subheadTextElement.style.height="60px";subheadTextElement.style.lineHeight="60px"}}else{subheadTextElement.style.height="0px"}}function resetHeader(){var header=document.getElementById("contextMenuHeader");if(headText||subheadText){header=document.getElementById("contextMenuHeader");header.className="";if(headText){setHeadText("")}if(subheadText){setSubheadText("")}}}function resetMenuContent(){contextMenuContent.style.position="";contextMenuContent.style.top="";contextMenuContent.style.height="";contextMenuContent.style.overflowY=""}function init(){menu=document.getElementById("contextMenu");menu.addEventListener("webkitTransitionEnd",self.transitionEnd.bind(self));menu.addEventListener("mousedown",menuTouchStartHandler);menu.addEventListener("mousemove",menuTouchMoveHandler);menu.addEventListener("mouseup",menuTouchEndHandler);menuPageY=$(menu).offset().top;contextMenuContent=document.getElementById("contextMenuContent");contextMenuDelete=document.getElementById("contextMenuDelete");contextMenuHandle=document.getElementById("contextMenuHandle");modal=document.getElementById("contextMenuModal");setHeadText("");setSubheadText("");rotationHandler();window.addEventListener("orientationchange",rotationHandler,false)}function buildMenuItem(options){var menuItem,menuImage,imageUrl=options.imageUrl||options.icon||jQuery("#extension-url").text()+"images/generic_81_81_placeholder.png";menuItem=document.createElement("div");menuImage=document.createElement("img");menuImage.src=imageUrl;menuImage.setAttribute("width","81");menuImage.setAttribute("height","81");menuItem.appendChild(menuImage);menuItem.appendChild(document.createTextNode(options.label));menuItem.setAttribute("class","contextmenuItem");menuItem.setAttribute("actionId",options.actionId);menuItem.index=numItems;menuItem.active=false;menuItem.addEventListener("mousedown",menuItemTouchStartHandler);menuItem.addEventListener("mousemove",menuItemTouchMoveHandler);menuItem.addEventListener("mouseup",menuItemTouchEndHandler);if(options.isDelete||options.actionId==="Delete"){menuItem.isDelete=true}return menuItem}self={init:init,handleMouseDown:handleMouseDown,setMenuOptions:function(options){var menuItem,deleteMenuItem,i;for(i=0;i<options.length;i++){if(options[i].headText||options[i].subheadText){if(options[i].headText){headText=options[i].headText}if(options[i].subheadText){subheadText=options[i].subheadText}continue}menuItem=buildMenuItem(options[i]);if(menuItem.isDelete){while(contextMenuDelete.firstChild){contextMenuDelete.removeChild(contextMenuDelete.firstChild)}contextMenuDelete.appendChild(menuItem);deleteMenuItem=buildMenuItem(options[i]);deleteMenuItem.setAttribute("class","hideContextMenuItem");contextMenuContent.appendChild(deleteMenuItem)}else{if(numItems>=maxNumItemsInPeekMode){menuItem.setAttribute("class","hideContextMenuItem")}contextMenuContent.appendChild(menuItem)}numItems++}},showContextMenu:function(evt){var i,header,items;if(menuCurrentState===state.VISIBLE){return}menu.style.webkitTransitionDuration="0.25s";menu.className="showContextMenu";contextMenuContent.className="contentShown";contextMenuHandle.className="showContextMenuHandle";if(evt){evt.preventDefault();evt.stopPropagation()}if(headText||subheadText){header=document.getElementById("contextMenuHeader");header.className="showMenuHeader";if(headText){setHeadText(headText)}if(subheadText){setSubheadText(subheadText)}if(numItems>maxNumItemsInPeekMode){contextMenuContent.style.position="absolute";contextMenuContent.style.top="131px"}}if(numItems>maxNumItemsInPeekMode){contextMenuContent.style.position="absolute";contextMenuContent.style.top=headText||subheadText?"131px":"0px";contextMenuContent.style.height=headText||subheadText?"80%":"100%";contextMenuContent.style.overflowY="scroll";contextMenuContent.scrollTop=0}items=contextMenuContent.childNodes;if(items.length>maxNumItemsInPeekMode){for(i=0;i<items.length;i+=1){items[i].className="contextmenuItem"}contextMenuDelete.style.webkitTransitionDuration="0.25s";contextMenuDelete.className="hideContextMenuDelete"}menuCurrentState=state.VISIBLE;positionHandle()},isMenuVisible:function(){return menuCurrentState===state.PEEK||menuCurrentState===state.VISIBLE},hideContextMenu:function(evt){if(menuCurrentState===state.HIDE){return}numItems=0;menu.style.webkitTransitionDuration="0.25s";menu.className="hideMenu";menu.removeEventListener("mousedown",menuTouchStartHandler,false);menu.removeEventListener("mousemove",menuTouchMoveHandler,false);menu.removeEventListener("mouseup",menuTouchEndHandler,false);window.document.body.removeEventListener("mousedown",bodyTouchStartHandler,false);window.document.body.removeEventListener("mousemove",bodyTouchMoveHandler,false);window.document.body.removeEventListener("mouseup",bodyTouchEndHandler,false);while(contextMenuContent.firstChild){contextMenuContent.removeChild(contextMenuContent.firstChild)}contextMenuContent.style.position="";contextMenuContent.style.top="";if(evt){evt.preventDefault();evt.stopPropagation()}menuCurrentState=state.HIDE;modal.style.display="none";document.getElementById("contextMenuHeader").className=""},setHeadText:setHeadText,setSubheadText:setSubheadText,peekContextMenu:function(){if(menuCurrentState===state.PEEK){return}peekModeNumItems=numItems>maxNumItemsInPeekMode?maxNumItemsInPeekMode:numItems;elements=document.getElementsByClassName("contextmenuItem");var items,i;menu.style.webkitTransitionDuration="0.25s";menu.className="peekContextMenu";contextMenuHandle.className="showContextMenuHandle";if(menuCurrentState===state.DRAGEND||menuCurrentState===state.VISIBLE){items=contextMenuContent.childNodes;if(items.length>maxNumItemsInPeekMode){for(i=maxNumItemsInPeekMode;i<items.length;i+=1){items[i].className="hideContextMenuItem"}}for(i=0;i<items.length;i+=1){if(items[i].isDelete){items[i].className="hideContextMenuItem"}}}contextMenuDelete.style.webkitTransitionDuration="0s";contextMenuDelete.className="";resetHeader();resetMenuContent();menu.style.overflowX="visible";menu.style.overflowY="visible";window.document.body.addEventListener("mousedown",bodyTouchStartHandler);window.document.body.addEventListener("mousemove",bodyTouchMoveHandler);window.document.body.addEventListener("mouseup",bodyTouchEndHandler);modal.style.display="";menuCurrentState=state.PEEK;positionHandle()},transitionEnd:function(){if(menuCurrentState===state.HIDE){self.setHeadText("");self.setSubheadText("");headText="";subheadText=""}}};module.exports=self});ripple.define("ui/plugins/deviceSettings",function(ripple,exports,module){var constants=ripple("constants"),deviceSettings=ripple("deviceSettings"),utils=ripple("utils"),exception=ripple("exception"),platform=ripple("platform"),event=ripple("event"),_CONST={CONTENT_CONTAINER_ID:"devicesettings-content-container",UKNOWN_CONTROL_MESSAGE:"Unknown device control type"},_contentContainer,_CONTAINER_ID=_CONST.CONTENT_CONTAINER_ID;event.on("DeviceSettingsUpdated",function(inputKey,value){var node=$(document.getElementById("device-settings-"+inputKey));node.val(value)});function _appendSettingNode(labelNode,inputNode,label){var frag=document.createDocumentFragment(),rowNode=frag.appendChild(utils.createElement("tr")),tempTdNode;rowNode.appendChild(utils.createElement("td")).appendChild(labelNode);tempTdNode=rowNode.appendChild(utils.createElement("td"));if(label){tempTdNode.appendChild(label)}tempTdNode.appendChild(inputNode);return frag}function _buildDOMNode(setting,settingType,key){var settingsNode,tagName,jNode,fullKey=settingType+"."+key,savedSetting=deviceSettings.retrieve(fullKey),currentSetting=savedSetting||savedSetting===false||savedSetting===""||savedSetting===0?savedSetting:setting.control.value,domNode,domNodeLabel=null;switch(setting.control.type){case"text":case"number":case"range":case"checkbox":tagName="input";break;case"textarea":tagName="textarea";break;case"select":tagName="select";break;default:exception.raise(exception.types.Application,_CONST.UKNOWN_CONTROL_MESSAGE)}settingsNode=utils.createElement(tagName,setting.control.type==="select"?null:setting.control);if(setting.control.type==="range"){domNodeLabel=utils.createElement("label",{"class":constants.UI.LEFT_RANGE_LABEL_CLASS})}domNode=_appendSettingNode(utils.createElement("span",{innerHTML:setting.name,"class":constants.UI.TEXT_LABEL_CLASS}),settingsNode,domNodeLabel);jNode=jQuery(settingsNode);jNode.addClass(constants.UI.JQUERY_UI_INPUT_CLASSES);jNode.attr("id","device-settings-"+fullKey);switch(setting.control.type){case"checkbox":jNode.bind("click",function(){var checked=this.checked?true:false;deviceSettings.persist(fullKey,checked);if(typeof setting.callback==="function"){setting.callback(checked)}});if(currentSetting===true){jNode.attr("checked","checked")}break;case"text":case"textarea":case"number":jNode.val(currentSetting);utils.bindAutoSaveEvent(jNode,function(){deviceSettings.persist(fullKey,jNode.val());if(typeof setting.callback==="function"){setting.callback(jNode.val())}});break;case"select":case"range":if(setting.control.type==="select"){utils.forEach(setting.options,function(value,option){jNode.append(utils.createElement("option",{value:option,innerHTML:value}))})}else{if(domNodeLabel){domNodeLabel.innerHTML=currentSetting}}jNode.val(currentSetting).bind("change",function(){if(setting.control.type==="range"&&domNodeLabel){domNodeLabel.innerHTML=jQuery(this).val()}deviceSettings.persist(fullKey,jQuery(this).val());if(typeof setting.callback==="function"){setting.callback(jQuery(this).val(),currentSetting)}})}if(currentSetting!==setting.control.value){deviceSettings.register(fullKey,currentSetting)}return domNode}module.exports={panel:{domId:"devicesettings-panel-container",collapsed:true,pane:"right"},initialize:function(){var settings;_contentContainer=document.getElementById(_CONTAINER_ID);settings=platform.current().device;utils.forEach(settings,function(settingSection,settingType){var currentTableNode;_contentContainer.appendChild(utils.createElement("h3",{innerHTML:settingType}));currentTableNode=utils.createElement("table",{"class":constants.UI.PANEL_TABLE_CLASS});_contentContainer.appendChild(currentTableNode);utils.forEach(settingSection,function(setting,key){currentTableNode.appendChild(_buildDOMNode(setting,settingType,key));if(setting.callback){setting.callback(deviceSettings.retrieve(settingType+"."+key))}})})}}});ripple.define("ui/plugins/devices",function(ripple,exports,module){module.exports={panel:{domId:"devices-container",collapsed:true,pane:"left"}}});ripple.define("ui/plugins/exec-dialog",function(ripple,exports,module){function exec(func){return function(){var val=$("#exec-response").val();if(func){func.apply(null,val?[JSON.parse(val)]:[])}$("#exec-dialog").dialog("close")}}module.exports={initialize:function(){$("#exec-dialog").dialog({autoOpen:false,modal:true,title:"I Haz Cheeseburger?!?!",width:500,position:"center"}).hide();$("#exec-success").button();$("#exec-fail").button()},show:function(service,action,success,fail){console.log(service);console.log(action);$("#exec-success").prop("disabled",!success);$("#exec-fail").prop("disabled",!fail);$("#exec-service").text(service);$("#exec-action").text(action);$("#exec-dialog").dialog("open");$("#exec-success").unbind().bind("click",exec(success));$("#exec-fail").unbind().bind("click",exec(fail))}}});ripple.define("ui/plugins/firstRunCheck",function(ripple,exports,module){var utils=ripple("utils"),_platform=ripple("platform"),db=ripple("db");function _handleFirstRunResponse(platform,version){var device=jQuery("#device-select").val(),api={name:platform.id,version:version};_platform.changeEnvironment(api,device,function(){location.reload()})}function _addPlatformButton(platform,version){var section=jQuery(".platform-select-buttons"),buttonID="platform-"+platform.id+"-"+version,button=utils.createElement("button",{id:buttonID,"class":"ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"});button.appendChild(utils.createElement("span",{"class":"ui-button-text",innertext:platform.name+" ("+version+")"}));section.append(button);document.getElementById(buttonID).addEventListener("click",function(){_handleFirstRunResponse(platform,version)})}function _initializeFirstRunCheck(){var savedPlatform=db.retrieveObject("api-key"),firstRunOverlayNode,firstRunOptionsNode,width,p;if(!savedPlatform){width=jQuery(document).width();p=width/2-277;firstRunOverlayNode=jQuery(".first-run-window").css({display:"block"});firstRunOptionsNode=jQuery(".platform-select-dialog").css({display:"block",left:p+"px"});utils.forEach(_platform.getList(),function(platform){utils.forEach(platform,function(details,version){_addPlatformButton(details,version)})})}}module.exports={initialize:function(){if(utils.map(_platform.getList(),function(platform){return platform}).length>1){_initializeFirstRunCheck()}}}});ripple.define("ui/plugins/geoView",function(ripple,exports,module){var constants=ripple("constants"),geo=ripple("geo"),db=ripple("db"),event=ripple("event"),utils=ripple("utils"),platform=ripple("platform"),_gpsMapZoomLevel;function _updateGpsMap(){var positionInfo=geo.getPositionInfo(),mapContainer=document.getElementById(constants.GEO.OPTIONS.MAP_CONTAINER),geoZoomValue=document.getElementById(constants.GEO.MAP_ZOOM_LEVEL_CONTAINER);if(mapContainer){geo.map.setCenter(new OpenLayers.LonLat(positionInfo.longitude,positionInfo.latitude).transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913")),_gpsMapZoomLevel,true)}if(geoZoomValue){geoZoomValue.innerHTML=_gpsMapZoomLevel}}function _updateGpsMapZoom(goUp){if(goUp&&_gpsMapZoomLevel<constants.GEO.MAP_ZOOM_MAX){_gpsMapZoomLevel++}else if(!goUp&&_gpsMapZoomLevel>constants.GEO.MAP_ZOOM_MIN){_gpsMapZoomLevel--}document.getElementById(constants.GEO.MAP_ZOOM_LEVEL_CONTAINER).innerHTML=_gpsMapZoomLevel;_updateGpsMap();db.save(constants.GEO.MAP_ZOOM_KEY,_gpsMapZoomLevel)}function _getTextHeading(heading){if(heading>=337.5||heading>=0&&heading<=22.5){return"N"}if(heading>=22.5&&heading<=67.5){return"NE"}if(heading>=67.5&&heading<=112.5){return"E"}if(heading>=112.5&&heading<=157.5){return"SE"}if(heading>=157.5&&heading<=202.5){return"S"}if(heading>=202.5&&heading<=247.5){return"SW"}if(heading>=247.5&&heading<=292.5){return"W"}if(heading>=292.5&&heading<=337.5){return"NW"}}module.exports={panel:{domId:"gps-container",collapsed:true,pane:"right"},initialize:function(){var GEO_OPTIONS=constants.GEO.OPTIONS,positionInfo=geo.getPositionInfo(),positionEvent="PositionInfoUpdatedEvent",latitude=document.getElementById(GEO_OPTIONS.LATITUDE),longitude=document.getElementById(GEO_OPTIONS.LONGITUDE),altitude=document.getElementById(GEO_OPTIONS.ALTITUDE),accuracy=document.getElementById(GEO_OPTIONS.ACCURACY),altitudeAccuracy=document.getElementById(GEO_OPTIONS.ALTITUDE_ACCURACY),heading=document.getElementById(GEO_OPTIONS.HEADING),speed=document.getElementById(GEO_OPTIONS.SPEED),cellID=document.getElementById(GEO_OPTIONS.CELL_ID),delay=document.getElementById(GEO_OPTIONS.DELAY),delayLabel=document.getElementById(GEO_OPTIONS.DELAY_LABEL),headingLabel=document.getElementById(GEO_OPTIONS.HEADING_LABEL),headingMapLabel=document.getElementById(GEO_OPTIONS.HEADING_MAP_LABEL),timeout=document.getElementById(GEO_OPTIONS.TIMEOUT),gpxMultiplier=document.getElementById(GEO_OPTIONS.GPXMULTIPLIER),gpxReplayStatus=document.getElementById(GEO_OPTIONS.GPXREPLAYSTATUS),gpxGo=$(document.getElementById(GEO_OPTIONS.GPXGO)).find("span")[0],mapMarker=document.getElementById(GEO_OPTIONS.MAP_MARKER),mapContainer=document.getElementById(GEO_OPTIONS.MAP_CONTAINER),map=null,track=[],_replayingGpxFile=false,_haltGpxReplay=false;function updateGeo(){geo.updatePositionInfo({latitude:parseFloat(latitude.value),longitude:parseFloat(longitude.value),altitude:parseInt(altitude.value,10),accuracy:parseInt(accuracy.value,10),altitudeAccuracy:parseInt(altitudeAccuracy.value,10),heading:heading.value?parseFloat(heading.value):0,speed:speed.value?parseInt(speed.value,10):0,cellID:cellID.value,timeStamp:new Date},delay.value,timeout.checked)}function updateHeadingValues(){var headingDeg=parseFloat(heading.value),headingText=_getTextHeading(parseFloat(heading.value));headingLabel.innerHTML=headingText;headingMapLabel.innerHTML=headingText+"</br>"+headingDeg+"°";mapMarker.setAttribute("style","-webkit-transform: rotate("+headingDeg+"deg);")}function updateValsFromMap(){var center=geo.map.getCenter().transform(new OpenLayers.Projection("EPSG:900913"),new OpenLayers.Projection("EPSG:4326"));longitude.value=center.lon;latitude.value=center.lat;updateGeo()}function initializeValues(){latitude.value=positionInfo.latitude;longitude.value=positionInfo.longitude;altitude.value=positionInfo.altitude;accuracy.value=positionInfo.accuracy;altitudeAccuracy.value=positionInfo.altitudeAccuracy;cellID.value=positionInfo.cellID;delay.value=document.getElementById(GEO_OPTIONS.DELAY_LABEL).innerHTML=geo.delay||0;if(geo.timeout){timeout.checked=true}updateHeadingValues()}function initMap(){OpenLayers.ImgPath="http://openlayers.org/api/img/";geo.map=new OpenLayers.Map(mapContainer,{controls:[],theme:null});geo.map.addLayer(new OpenLayers.Layer.OSM);geo.map.addControl(new OpenLayers.Control.Navigation);var clickHandler=new OpenLayers.Handler.Click(this,{click:function(e){var lonlat=geo.map.getLonLatFromViewPortPx(e.xy);geo.map.panTo(new OpenLayers.LonLat(lonlat.lon,lonlat.lat),_gpsMapZoomLevel)},dblclick:function(){_updateGpsMapZoom(true)}},{"double":true});clickHandler.setMap(geo.map);clickHandler.activate();geo.map.events.register("moveend",map,function(){updateValsFromMap()});event.on("ApplicationState",function(obj){if(obj&&obj[0].id==="gps-container"&&obj.hasClass("ui-box-open")){_updateGpsMap()}})}function loadGpxFile(filename){var reader=new FileReader,_xml,t,att,lastAtt,_ele,_timestamp,_lastTimestamp,_useTimestamp=(new Date).getTime(),_tempTimestamp,_tempPosition,_lastPosition,_useLastTimestamp,_heading=0,_speed=0,_dist=0,navUtils=new utils.navHelper;reader.onload=function(e){_xml=e.target.result;t=$(_xml).find("trkpt");track=[];utils.forEach(t,function(p,i){if(!isNaN(i)){att=t[i].attributes;lastAtt=t[i-1]?t[i-1].attributes:{};_ele=$(t[i]).find("ele")[0];_timestamp=$(t[i]).find("time")[0];_lastTimestamp=$(t[i-1]).find("time")[0];if(_timestamp){_useTimestamp=new Date(_timestamp.innerHTML).getTime()}if(t[i-1]){_dist=navUtils.getDistance(att["lat"].value,att["lon"].value,lastAtt["lat"].value,lastAtt["lon"].value);if(_lastTimestamp){_useLastTimestamp=new Date(_lastTimestamp.innerHTML).getTime()}else{_useLastTimestamp=_useTimestamp;_useTimestamp+=Math.round(_dist/22.2222*1e3)}_heading=navUtils.getHeading(lastAtt["lat"].value,lastAtt["lon"].value,att["lat"].value,att["lon"].value);_speed=(_dist/((_useTimestamp-_useLastTimestamp)/1e3)).toFixed(2);if(!_lastTimestamp){_tempTimestamp=_useLastTimestamp;while(_useTimestamp-_tempTimestamp>1e3){_tempTimestamp+=1e3;_lastPosition=track[track.length-1].coords;_tempPosition=navUtils.simulateTravel(_lastPosition.latitude,_lastPosition.longitude,_heading,_speed);track.push({coords:{latitude:_tempPosition.latitude,longitude:_tempPosition.longitude,altitude:_ele?_ele.innerHTML:0,accuracy:150,altitudeAccuracy:80,heading:_heading,speed:_speed},timestamp:_tempTimestamp})}}}track.push({coords:{latitude:att["lat"].value,longitude:att["lon"].value,altitude:_ele?_ele.innerHTML:0,accuracy:150,altitudeAccuracy:80,heading:_heading,speed:_speed},timestamp:_useTimestamp})}})};reader.onerror=function(e){console.log("Ripple :: error reading gpx file "+filename+": "+e)};reader.readAsText(filename,"UTF-8")}function replayGpxTrack(){if(_replayingGpxFile){_haltGpxReplay=true;gpxGo.innerHTML=constants.GEO.GPXGO_LABELS.GO}else{if(track.length>0){_haltGpxReplay=false;gpxGo.innerHTML=constants.GEO.GPXGO_LABELS.STOP;latitude.value=track[0].coords.latitude;longitude.value=track[0].coords.longitude;altitude.value=track[0].coords.altitude;accuracy.value=track[0].coords.accuracy;altitudeAccuracy.value=track[0].coords.altitudeAccuracy;heading.value=track[0].coords.heading;speed.value=track[0].coords.speed;updateGeo();updateHeadingValues();_triggerEvent();moveNextGpxTrack(1)}}}function moveNextGpxTrack(i){if(_haltGpxReplay){_replayingGpxFile=false;_haltGpxReplay=false;console.log("Ripple :: User interrupted replay of GPX file (Aye Captain, answers All Stop.)")}else{_replayingGpxFile=true;var _timeMultiplier=!isNaN(gpxMultiplier.value)?gpxMultiplier.value:1,_step=0,_interval=0;while(_interval<250){_step++;if(i+_step>=track.length){break}_interval=(track[i+_step].timestamp-track[i].timestamp)/_timeMultiplier}gpxReplayStatus.textContent=(_interval/1e3).toFixed(2)+"s ("+(_interval/1e3*_timeMultiplier).toFixed(2)+"s realtime), "+(i+1)+" of "+track.length+" (stepping "+_step+" at "+_timeMultiplier+"x)";setTimeout(function(){latitude.value=track[i].coords.latitude;longitude.value=track[i].coords.longitude;altitude.value=track[i].coords.altitude;accuracy.value=track[i].coords.accuracy;altitudeAccuracy.value=track[i].coords.altitudeAccuracy;heading.value=track[i].coords.heading;speed.value=track[i].coords.speed;updateGeo();updateHeadingValues();_triggerEvent();if(track[i+_step]){moveNextGpxTrack(i+_step)}else{if(i<track.length-1){moveNextGpxTrack(track.length-1)}else{_replayingGpxFile=false;gpxGo.innerHTML=constants.GEO.GPXGO_LABELS.GO;console.log("Ripple :: Finished replaying GPX file (Arriving at our destination, assuming standard orbit Captain.)");
}}},_interval)}}if(platform.current().id==="phonegap"||platform.current().id==="webworks"||platform.current().id==="cordova"){jQuery("#geo-cellid-container").hide();jQuery("#geo-heading-container").show();jQuery("#geo-speed-container").show()}else{jQuery("#geo-cellid-container").show();jQuery("#geo-heading-container").hide();jQuery("#geo-speed-container").hide()}_gpsMapZoomLevel=db.retrieve(constants.GEO.MAP_ZOOM_KEY)||14;jQuery("#geo-map-zoom-decrease").bind("click",function(){_updateGpsMapZoom(false)});jQuery("#geo-map-zoom-increase").bind("click",function(){_updateGpsMapZoom(true)});utils.bindAutoSaveEvent(jQuery("#"+GEO_OPTIONS.LATITUDE),updateGeo);utils.bindAutoSaveEvent(jQuery("#"+GEO_OPTIONS.LONGITUDE),updateGeo);utils.bindAutoSaveEvent(jQuery("#"+GEO_OPTIONS.ALTITUDE),updateGeo);utils.bindAutoSaveEvent(jQuery("#"+GEO_OPTIONS.ACCURACY),updateGeo);utils.bindAutoSaveEvent(jQuery("#"+GEO_OPTIONS.ALTITUDE_ACCURACY),updateGeo);utils.bindAutoSaveEvent(jQuery("#"+GEO_OPTIONS.CELL_ID),updateGeo);jQuery("#"+GEO_OPTIONS.DELAY).bind("change",function(){updateGeo();delayLabel.innerHTML=delay.value});jQuery("#"+GEO_OPTIONS.TIMEOUT).bind("click",function(){updateGeo()});jQuery("#"+GEO_OPTIONS.GPXFILE).bind("change",function(a){var selectedFiles=a.target.files;if(selectedFiles.length>0)loadGpxFile(selectedFiles[0])});jQuery("#"+GEO_OPTIONS.GPXGO).bind("click",function(){replayGpxTrack()});if(platform.current().id==="phonegap"||platform.current().id==="webworks"||platform.current().id==="cordova"){jQuery("#"+GEO_OPTIONS.HEADING).bind("change",function(){updateGeo();updateHeadingValues()});utils.bindAutoSaveEvent(jQuery("#"+GEO_OPTIONS.SPEED),updateGeo);heading.value=positionInfo.heading;speed.value=positionInfo.speed}initMap();initializeValues();event.on(positionEvent,function(){_updateGpsMap()});_triggerEvent();function _triggerEvent(){event.trigger(positionEvent,[{latitude:latitude.value,longitude:longitude.value,altitude:altitude.value,accuracy:accuracy.value,altitudeAccuracy:altitudeAccuracy.value,heading:heading?heading.value:0,speed:speed?speed.value:0,cellID:cellID.value,timeStamp:new Date}])}}}});ripple.define("ui/plugins/goodVibrations",function(ripple,exports,module){module.exports={vibrateDevice:function(milliseconds){var node=jQuery("#device-container"),x,times;times=Math.floor(milliseconds/160);for(x=1;x<=times;x++){node.animate({left:-10},5).animate({left:0},1).animate({left:10},5).animate({left:0},1);node.animate({top:-10},5).animate({top:0},1).animate({top:10},5).animate({top:0},1)}},shakeDevice:function(times){var node=jQuery("#device-container"),x;for(x=1;x<=times;x++){node.animate({left:-25},50).animate({left:0},30).animate({left:25},50).animate({left:0},30)}},stop:function(){var node=jQuery("#device-container");node.clearQueue();node.stop(true,true)}}});ripple.define("ui/plugins/information",function(ripple,exports,module){var constants=ripple("constants"),devices=ripple("devices"),event=ripple("event"),platform=ripple("platform"),utils=ripple("utils"),app=ripple("app");function _updateInformationView(){var infoPane=document.getElementById(constants.COMMON.INFO_SECTION),infoList=[],device=devices.getCurrentDevice(),tempString="",widgetInfo=app.getInfo();infoList.push('<section id="information-banner" style="display:none"><img id="information-banner-icon" width="16px" height="16px"/> <span id="information-banner-count"></span></section>');if(widgetInfo.icon){infoList.push('<section class="information-widgeticon"><img class="ui-corner-all" width="64" src="'+utils.appLocation()+widgetInfo.icon+'" alt="widget icon"/></section>')}if(widgetInfo.name){infoList.push('<section class="information-widgetname text-is-selectable">'+widgetInfo.name+"</section>")}if(widgetInfo.version){infoList.push('<section class="information-widgetversion"><label class="ui-text-label">Version: </label><span class="text-is-selectable">'+widgetInfo.version+"</span></section>")}infoList.push('<section><label class="ui-text-label">Platform: </label><span class="text-is-selectable">'+platform.current().name+"</span></section>");infoList.push('<section><label class="ui-text-label">Device: </label><span class="text-is-selectable">'+device.name+"</span></section>");infoList.push('<section><label class="ui-text-label">OS: </label><span class="text-is-selectable">'+device.osName+" "+device.osVersion+"</span></section>");infoList.push('<section><label class="ui-text-label">Manufacturer: </label><span class="text-is-selectable">'+device.manufacturer+"</span></section>");infoList.push('<section><label class="ui-text-label">Screen: </label><span class="text-is-selectable">'+device.screen.width+"x"+device.screen.height+"</span></section>");if(device.screen.height!==device.viewPort.portrait.height){infoList.push('<section><label class="ui-text-label">Viewport: </label><span class="text-is-selectable">'+device.viewPort.portrait.width+"x"+device.viewPort.portrait.height+"</span></section>")}infoList.push('<section><label class="ui-text-label">Density: </label><span class="text-is-selectable">'+device.ppi+" PPI</span></section>");if(device.mediaQueryEmulation&&device.mediaQueryEmulation["-webkit-device-pixel-ratio"]){infoList.push('<section><label class="ui-text-label">CSS Pixel Ratio: </label><span class="text-is-selectable">'+device.mediaQueryEmulation["-webkit-device-pixel-ratio"]+"</span></section>");infoList.push('<section><label class="ui-text-label">CSS Pixels: </label><span class="text-is-selectable">'+Math.floor(device.screen.width/device.mediaQueryEmulation["-webkit-device-pixel-ratio"])+"x"+Math.floor(device.screen.height/device.mediaQueryEmulation["-webkit-device-pixel-ratio"])+"</span></section>")}infoList.push('<section><label class="ui-text-label" style="float:left; padding-top: 0px; ">User Agent: </label>'+'<div class="text-is-selectable" style="padding-left: 80px">'+device.userAgent+"</div></section>");if(device.notes){utils.forEach(device.notes,function(note){tempString+='<li class="text-is-selectable">'+note+"</li>"});infoList.push('<section><div style="clear:both;"></div><label class="ui-text-label">Notes: </label><ul>'+tempString+"</ul></section>")}infoPane.innerHTML=infoList.join("")}function _updateBanner(icon,count){var bannerSection=document.getElementById("information-banner"),iconImg=document.getElementById("information-banner-icon"),countSpan=document.getElementById("information-banner-count");if(icon&&(count===undefined||count!==0)){count=count||"";jQuery("#"+constants.COMMON.INFO_SECTION).show();jQuery(bannerSection).fadeToggle(1e3);jQuery(bannerSection).fadeIn(1e3)}else{jQuery(bannerSection).fadeOut(1e3)}iconImg.src=utils.appLocation()+icon;if(icon.indexOf("http")===0){iconImg.src=icon}countSpan.innerHTML=count>99?"99+":count}module.exports={panel:{domId:"information-container",collapsed:false,pane:"left"},initialize:function(){event.on("BannerUpdated",function(icon,count){_updateBanner(icon,count)});event.on("PlatformChangedEvent",function(){_updateInformationView()});event.on("WidgetInformationUpdated",function(){_updateInformationView()});_updateInformationView()}}});ripple.define("ui/plugins/invoke",function(ripple,exports,module){var event=ripple("event");module.exports={panel:{domId:"invoke-container",collapsed:true,pane:"left"},initialize:function(){document.getElementById("invoke-send").addEventListener("click",function(){var invokeInfo={};invokeInfo.uri=document.getElementById("invoke-uri-text").value;invokeInfo.source=document.getElementById("invoke-source-text").value;invokeInfo.target=document.getElementById("invoke-target-text").value;invokeInfo.action=document.getElementById("invoke-action-text").value;invokeInfo.type=document.getElementById("invoke-mime-type-text").value;invokeInfo.extension=document.getElementById("invoke-extension-text").value;invokeInfo.data=document.getElementById("invoke-data-text").value;if(invokeInfo.data){invokeInfo.data=window.btoa(invokeInfo.data)}event.trigger("AppInvoke",[invokeInfo])},false)}}});ripple.define("ui/plugins/layout",function(ripple,exports,module){var constants=ripple("constants"),db=ripple("db"),resizer=ripple("resizer"),devices=ripple("devices"),event=ripple("event");function _initializeLayout(){var layout=db.retrieve("layout"),layoutLandscape=document.getElementById(constants.COMMON.ORIENTATION_SELECT_LANDSCAPE_ID),layoutPortrait=document.getElementById(constants.COMMON.ORIENTATION_SELECT_PORTRAIT_ID),currentDevice=devices.getCurrentDevice(),defaultOrientation=currentDevice?currentDevice.defaultOrientation:null,layoutTypeChanged=false;jQuery("#"+constants.COMMON.ORIENTATION_SELECT_LANDSCAPE_ID).bind("click",function(){resizer.changeLayoutType("landscape");event.trigger("LayoutChanged",["landscape"],true);layoutLandscape.setAttribute("class","layout-selected");layoutPortrait.setAttribute("class","layout-not-selected")});jQuery("#"+constants.COMMON.ORIENTATION_SELECT_PORTRAIT_ID).bind("click",function(){resizer.changeLayoutType("portrait");event.trigger("LayoutChanged",["portrait"],true);layoutLandscape.setAttribute("class","layout-not-selected");layoutPortrait.setAttribute("class","layout-selected")});jQuery("#"+constants.COMMON.MENU_BUTTON).bind("click",function(){event.trigger("HardwareKey",[1])});jQuery("#"+constants.COMMON.BACK_BUTTON).bind("click",function(){event.trigger("HardwareKey",[0])});if(!layout){layout=defaultOrientation||"portrait";layoutTypeChanged=true;resizer.changeLayoutType(layout)}if(!currentDevice.viewPort.landscape){layoutLandscape.setAttribute("style","display:none")}if(!currentDevice.viewPort.portrait){layoutPortrait.setAttribute("style","display:none")}if(layout&&layout==="portrait"){layoutLandscape.setAttribute("class","layout-not-selected");layoutPortrait.setAttribute("class","layout-selected")}else if(layout&&layout==="landscape"){layoutLandscape.setAttribute("class","layout-selected");layoutPortrait.setAttribute("class","layout-not-selected")}if(!layoutTypeChanged){resizer.resize(currentDevice)}}module.exports={initialize:_initializeLayout}});ripple.define("ui/plugins/messaging",function(ripple,exports,module){var event=ripple("event");module.exports={panel:{domId:"messaging-container",collapsed:true,pane:"left"},initialize:function(){document.getElementById("messaging-send").addEventListener("click",function(){var number=document.getElementById("messaging-sms-number").value,text=document.getElementById("messaging-text").value,message={type:"sms",body:text,from:number,time:new Date};event.trigger("MessageReceived",[message])},false)}}});ripple.define("ui/plugins/notifications",function(ripple,exports,module){var constants=ripple("constants"),notifications=ripple("notifications");module.exports={initialize:function(){jQuery("."+constants.NOTIFICATIONS.CLOSE_BUTTON_CLASS).bind("click",function(){notifications.closeNotification()});jQuery("#confirm-dialog").dialog({autoOpen:false,modal:true,width:200,position:"center"})}}});ripple.define("ui/plugins/panelCollapse",function(ripple,exports,module){var db=ripple("db"),_LEFT_PANEL_COLLAPSE=".left-panel-collapse",_RIGHT_PANEL_COLLAPSE=".right-panel-collapse",_LEFT_PANEL=".left",_RIGHT_PANEL=".right",_SAVE_KEY="panel-collapsed",_leftEngaged,_rightEngaged,_store;function _persist(){db.saveObject(_SAVE_KEY,_store)}function _updateLayout(){var node=document.querySelector("#device-container"),leftPanelClosed=document.querySelector(_LEFT_PANEL).style.opacity==="0.1",rightPanelClosed=document.querySelector(_RIGHT_PANEL).style.opacity==="0.1";if(leftPanelClosed&&rightPanelClosed){node.style.margin="0 auto 0 auto"}else if(rightPanelClosed){jQuery(node).animate({marginRight:"3%"})}else if(leftPanelClosed){jQuery(node).animate({marginLeft:"3%"})}else{node.style.margin="0 auto 0 auto"}}function _process(collapseNode,panelNode,side,callback){var jNode=collapseNode.children("span"),jPanelNode=jQuery(panelNode),properties={},collapseProperties={},options={duration:600,complete:callback},oldIcon,newIcon;if(_store[side]===true){_store[side]=false;oldIcon=side==="left"?"ui-icon-arrowthick-1-e":"ui-icon-arrowthick-1-w";newIcon=side==="left"?"ui-icon-arrowthick-1-w":"ui-icon-arrowthick-1-e";properties[side]="0px";collapseProperties[side]="345px";properties.opacity="1"}else{_store[side]=true;oldIcon=side==="left"?"ui-icon-arrowthick-1-w":"ui-icon-arrowthick-1-e";newIcon=side==="left"?"ui-icon-arrowthick-1-e":"ui-icon-arrowthick-1-w";properties[side]="-340px";collapseProperties[side]="5px";properties.opacity="0.1"}jNode.removeClass(oldIcon).addClass(newIcon);jPanelNode.animate(properties,options);collapseNode.animate(collapseProperties,600);_persist()}module.exports={initialize:function(){var rightCollapseNode=jQuery(_RIGHT_PANEL_COLLAPSE),leftCollapseNode=jQuery(_LEFT_PANEL_COLLAPSE);_store=db.retrieveObject(_SAVE_KEY)||{left:false,right:false};if(_store.left===true){jQuery(_LEFT_PANEL).css({left:"-340px",opacity:"0.1"});leftCollapseNode.css({left:"5px"}).children("span").removeClass("ui-icon-arrowthick-1-w").addClass("ui-icon-arrowthick-1-e")}if(_store.right===true){jQuery(_RIGHT_PANEL).css({right:"-340px",opacity:"0.1"});rightCollapseNode.css({right:"5px"}).children("span").removeClass("ui-icon-arrowthick-1-e").addClass("ui-icon-arrowthick-1-w")}leftCollapseNode.bind("click",function(){if(!_leftEngaged){_leftEngaged=true;_process(leftCollapseNode,_LEFT_PANEL,"left",function(){_leftEngaged=false;_updateLayout()})}});rightCollapseNode.bind("click",function(){if(!_rightEngaged){_rightEngaged=true;_process(rightCollapseNode,_RIGHT_PANEL,"right",function(){_rightEngaged=false;_updateLayout()})}});_updateLayout()}}});ripple.define("ui/plugins/phone",function(ripple,exports,module){var utils=ripple("utils"),Phone=ripple("platform/webworks.handset/2.0.0/client/Phone"),CallLog=ripple("platform/webworks.handset/2.0.0/client/CallLog"),event=ripple("event"),_console=ripple("console"),eventSelect=document.getElementById("phone-event-types"),eventErrorContainer=document.getElementById("phone-event-error-container"),eventErrorSelect=document.getElementById("phone-event-error-types");function _firePhoneLogEvents(type,number){if(type===Phone.CB_CALL_INITIATED||type===Phone.CB_CALL_ANSWERED){event.trigger("PhoneCallLogAdded",[{date:new Date,number:number,status:CallLog.STATUS_NORMAL,type:CallLog.TYPE_RECEIVED_CALL}],true)}else if(type===Phone.CB_CALL_ENDED_BYUSER||type===Phone.CB_CALL_FAILED){event.trigger("PhoneCallLogAdded",[{date:new Date,number:number,status:CallLog.STATUS_NORMAL,type:CallLog.TYPE_PLACED_CALL}],true)}}function _updateActiveCalls(type,number){if(type===Phone.CB_CALL_INITIATED||type===Phone.CB_CALL_CONNECTED||type===Phone.CB_CALL_CONFERENCECALL_ESTABLISHED||type===Phone.CB_CALL_DIRECTCONNECT_CONNECTED||type===Phone.CB_CALL_ANSWERED){event.trigger("PhoneCallInitiated",[{id:number,onhold:false,outgoing:false,recipient:{name:"",number:String(number)}}],true)}else if(type===Phone.CB_CALL_ENDED_BYUSER||type===Phone.CB_CALL_FAILED||type===Phone.CB_CALL_DISCONNECTED||type===Phone.CB_CONFERENCECALL_DISCONNECTED||type===Phone.CB_CALL_DIRECTCONNECT_DISCONNECTED){event.trigger("PhoneCallEnded",[{id:number}],true)}}module.exports={panel:{domId:"phone-container",collapsed:true,pane:"right"},initialize:function(){utils.forEach(Phone,function(value,prop){if(prop.match(/^CB_/)){eventSelect.appendChild(utils.createElement("option",{value:value,innerHTML:prop.replace(/^CB_(CALL_)?/,"")}))}if(prop.match(/^CALL_ERROR_/)){eventErrorSelect.appendChild(utils.createElement("option",{value:value,innerHTML:prop.replace(/^CALL_ERROR_/,"")}))}});document.getElementById("phone-event-types").addEventListener("change",function(){eventErrorContainer.setAttribute("style",parseInt(eventSelect.value,10)===Phone.CB_CALL_FAILED?"":"display: none")});document.getElementById("phone-logs-clear").addEventListener("click",function(){event.trigger("PhoneCallLogReset")});document.getElementById("phone-event-send").addEventListener("click",function(){var type=parseInt(eventSelect.value,10),error=type===Phone.CB_CALL_FAILED?eventErrorSelect.value:undefined,callId=document.getElementById("phone-call-id").value;_firePhoneLogEvents(type,callId,error);_updateActiveCalls(type,callId,error);event.trigger("PhoneEvent",[type,callId,error]);_console.log("Fired PhoneEvent (type "+type+") CallID: "+callId+(error?" (error type "+error+")":""))},false)}}});ripple.define("ui/plugins/platform",function(ripple,exports,module){var constants=ripple("constants"),utils=ripple("utils"),devices=ripple("devices"),platform=ripple("platform"),tooltip=ripple("ui/plugins/tooltip");function _animateChangePlatformButton(){jQuery("#change-platform").animate({opacity:.5},500).animate({opacity:1},500).animate({opacity:.5},500).animate({opacity:1},500).animate({opacity:.5},500).animate({opacity:1},500)}function _updatePlatformDeviceSelect(platformID,currentDeviceKey){var devicesSelect=document.getElementById(constants.COMMON.DEVICE_SELECT_ID),listOfSortedDevices=devices.getDevicesForPlatform(platformID).sort(function(a,b){return a.name<b.name?-1:a.name>b.name?1:0});devicesSelect.innerHTML="";listOfSortedDevices.forEach(function(dev){var deviceNode=utils.createElement("option",{innerHTML:dev.name,value:dev.id});if(currentDeviceKey&&deviceNode.value===currentDeviceKey){deviceNode.selected=true}devicesSelect.appendChild(deviceNode)})}function changePlatformOrDevice(){var platformId=jQuery("#platform-select").val(),version=jQuery("#version-select").val(),device=jQuery("#device-select").val();platform.changeEnvironment({name:platformId,version:version},device,function(){var original=utils.queryString().enableripple,updated=platformId+"-"+version+"-"+device;if(original){location.href=location.href.replace(new RegExp(original,"i"),updated)}else{location.reload()}})}module.exports={panel:{domId:"platforms-container",collapsed:true,pane:"left"},initialize:function(){var currentPlatform=platform.current().id,currentVersion=platform.current().version,platformList=platform.getList(),platformSelect=document.getElementById(constants.COMMON.PLATFORM_SELECT_ID),versionSelect=document.getElementById("version-select"),currentDeviceKey=devices.getCurrentDevice().id,platformNode,versionNode;jQuery("#platform-select").bind("change",function(){var newPlatform=jQuery(this).val(),newDevice=jQuery("#device-select").val();jQuery(versionSelect).children("option").remove();utils.forEach(platformList,function(platform){utils.forEach(platform,function(version,versionNumber){if(newPlatform===version.id){versionSelect.appendChild(utils.createElement("option",{innerHTML:versionNumber,value:versionNumber}))}})});_updatePlatformDeviceSelect(newPlatform,newDevice);jQuery("#"+constants.COMMON.DEVICE_SELECT_ID).effect("highlight",{color:"#62B4C8"},500,function(){_animateChangePlatformButton()})});jQuery("#change-platform").bind("click",changePlatformOrDevice);jQuery("#device-select").bind("change",changePlatformOrDevice);utils.forEach(platformList,function(platform){utils.forEach(platform,function(version,versionNumber){platformNode=utils.createElement("option",{innerHTML:version.name,value:version.id});if(currentPlatform&&version.id===currentPlatform){platformNode.selected=true;versionNode=utils.createElement("option",{innerHTML:versionNumber,value:versionNumber});if(currentVersion&¤tVersion===versionNumber){versionNode.selected=true}versionSelect.appendChild(versionNode)}if(jQuery(platformSelect).children("option").val()!==version.id){platformSelect.appendChild(platformNode)}})});_updatePlatformDeviceSelect(currentPlatform,currentDeviceKey);tooltip.create("#"+constants.COMMON.CHANGE_PLATFORM_BUTTON_ID,"This action will reload your page.")}}});ripple.define("ui/plugins/platformEvents",function(ripple,exports,module){var _console=ripple("console"),platform=ripple("platform"),utils=ripple("utils");module.exports={panel:{domId:"platform-events-container",collapsed:true,pane:"right"},initialize:function(){var eventSelect=document.getElementById("platform-events-select"),spec=platform.current();if(!spec.events){return}utils.forEach(spec.events,function(method,name){eventSelect.appendChild(utils.createElement("option",{innerHTML:name,value:name}))});jQuery("#platform-events-fire").click(function(){var eventName=document.getElementById("platform-events-select").value,args=spec.events[eventName].args?document.getElementById("platform-events-args").value:null,callback=spec.events[eventName].callback;_console.log("fired event => "+eventName);try{callback(args)}catch(e){_console.log("Failed to raise: "+eventName);_console.log(e)}});jQuery(eventSelect).change(function(){var argsSelect=jQuery("#platform-events-args"),args=spec.events[this.value].args;argsSelect.empty();if(args){utils.forEach(spec.events[this.value].args,function(arg,index){argsSelect.append(utils.createElement("option",{innerHTML:arg,value:index}))});argsSelect.show()}else{argsSelect.hide()}})}}});ripple.define("ui/plugins/push",function(ripple,exports,module){var constants=ripple("constants"),event=ripple("event"),utils=ripple("utils"),db=ripple("db"),PUSH_OPTIONS=constants.PUSH.OPTIONS;function _updatePushPanel(ports){var portsSelect=document.getElementById("port-select"),currentPort=portsSelect.value;portsSelect.innerHTML="";ports.forEach(function(port){portsSelect.appendChild(utils.createElement("option",{innerHTML:port,value:port,selected:currentPort===port}))})}module.exports={panel:{domId:"push-container",collapsed:true,pane:"left"},initialize:function(){event.on("PushListenersChanged",function(listeners){_updatePushPanel(listeners);jQuery("#port-select").effect("highlight",{color:"#62B4C8"},1e3)});_updatePushPanel([]);document.getElementById("push-send").addEventListener("click",function(){var port=document.getElementById("port-select").value,text=document.getElementById(PUSH_OPTIONS.PAYLOAD).value,pushData={headerField:["21f39092"],requestURI:"/",source:"ripple",isChannelEncrypted:false,payload:text};event.trigger("Push",[pushData,port],true)},false);utils.bindAutoSaveEvent(jQuery("#"+PUSH_OPTIONS.PAYLOAD),function(){db.save(PUSH_OPTIONS.PAYLOAD,document.getElementById(PUSH_OPTIONS.PAYLOAD).value)});document.getElementById(PUSH_OPTIONS.PAYLOAD).value=db.retrieve(PUSH_OPTIONS.PAYLOAD)||"My payload data"}}});ripple.define("ui/plugins/settings-dialog",function(ripple,exports,module){var db=ripple("db"),utils=ripple("utils"),platform=ripple("platform"),notifications=ripple("notifications"),tooltip=ripple("ui/plugins/tooltip"),bus=ripple("bus"),required={build:{"webworks.tablet":["sdk","projectPath","outputPath","projectName"],"webworks.bb10":["sdk","projectPath","outputPath","projectName"],"webworks.handset":["sdk","projectPath","outputPath","projectName"]},sign:{"webworks.tablet":["sdk","projectPath","outputPath","projectName","csk_password","p12_password","bundle_number"],"webworks.bb10":["sdk","projectPath","outputPath","projectName","signingPassword","bundle_number"],"webworks.handset":["sdk","projectPath","outputPath","projectName","signingPassword"]},launch:{"webworks.tablet":["sdk","projectPath","outputPath","projectName","device"],"webworks.bb10":["sdk","projectPath","outputPath","projectName","device"],"webworks.handset":["sdk","projectPath","outputPath","projectName","simulator"]}},_settings={get:function(){var settings=db.retrieveObject("build-settings",platform.getPersistencePrefix())||{};settings.debug=!!settings["remoteInspector"];return settings},save:function(settings){db.saveObject("build-settings",settings,platform.getPersistencePrefix())}},port="9910",host="http://127.0.0.1:"+port+"/ripple",progressContainer=jQuery("#options-progress"),progressInterval,_passwordFields=["signingPassword","devicePassword","csk_password","p12_password"],_checkboxFields=["remoteInspector"],_passwords={},_self;function missing(settings,action){return required[action][platform.current().id].filter(function(field){return!settings.hasOwnProperty(field)})}function _isPasswordField(id){var match=typeof id==="string"&&new RegExp("^"+id+"$","i");return match&&utils.some(_passwordFields,function(name){return match.test(name)})}function _isCheckboxField(id){var match=typeof id==="string"&&new RegExp("^"+id+"$","i");return match&&utils.some(_checkboxFields,function(name){return match.test(name)})}function table(action){var _table=$("<table class='panel-table'>"),_row={row:function(item,desc,opts){var id="settings-field-"+item.toLowerCase(),input="",save=function(){var s=_settings.get(),v=$("#"+id).val(),val=opts.type==="number"?parseInt(v,10):v;if(_isCheckboxField(item)){s[item]=$("#"+id).prop("checked")}else if(val){(_isPasswordField(item)?_passwords:s)[item]=val}else{delete s[item]}_settings.save(s);if(opts.onChanged){opts.onChanged(s[item])}},row;opts=opts||{type:"text"};switch(opts.type){case"select":if(opts.options){input="<select id='"+id+"' class='ui-state-default ui-corner-all' style='width:100%'>";opts.options.map(function(option){var settings;input+="<option"+(option.selected?" selected":"")+">"+option.value+"</option>";if(option.selected){settings=_settings.get();settings[item]=option.value;_settings.save(settings)}});input+="</select>"}else{input="<select id='"+id+"' class='ui-state-default ui-corner-all' style='width:100%'/>"}break;case"span":input="<span id = '"+id+"'>"+opts.text+"</span>";break;default:input="<input id='"+id+"' type='"+opts.type+"' class='ui-state-default ui-corner-all' style='width:90%' />";break}row=$("<tr>"+"<td><label for='"+id+"' class='ui-text-label'>"+desc+"</label></td>"+"<td>"+input+"</td>"+"</tr>");row.appendTo(_table);utils.bindAutoSaveEvent(row.find("#"+id).change(save),save);return _row},appendTo:function(id){var fs=$("<fieldset class='main'><legend class='cap-text'>"+action+"</legend></fieldset>");$(_table).appendTo(fs);fs.appendTo($(id))}};return _row}function create(){var build=table("build"),sign=table("sign"),launch=table("launch");build.row("sdk","SDK Path").row("projectPath","Project Root").row("projectName","Archive Name").row("outputPath","Output Folder").row("remoteInspector","Enable Remote Web Inspector",{type:"checkbox",onChanged:function(enabled){if(enabled){$("#options-menu-build-warning").show();tooltip.create("#options-menu-build-warning","Remote Web Inspector should be disabled when packaging for App World release")}else{$("#options-menu-build-warning").hide()}}}).appendTo("#settings-tabs-build");switch(platform.current().id){case"webworks.handset":sign.row("signingPassword","Password",{type:"password"});launch.row("simulator","Simulator",{type:"select"});launch.row("simulatorstatus","Simulator",{type:"span",text:"Searching for simulators ..."});break;case"webworks.tablet":sign.row("csk_password","CSK Password",{type:"password"});sign.row("p12_password","P12 Password",{type:"password"});sign.row("bundle_number","Bundle Number",{type:"number"});launch.row("device","Playbook IP");launch.row("devicePassword","Playbook Password",{type:"password"});break;case"webworks.bb10":sign.row("signingPassword","Signing Password",{type:"password"});sign.row("bundle_number","Bundle Number",{type:"number"});launch.row("deployTarget","Target",{type:"select",options:[{value:"Simulator",selected:true},{value:"Device"}]});launch.row("device","Device IP");launch.row("devicePassword","Device Password",{type:"password"});break}sign.appendTo("#settings-tabs-build");launch.appendTo("#settings-tabs-build");$("#settings-field-simulator").parent().parent().hide()}function populate(settings){var fill=function(action,prop){var element=$("#settings-field-"+prop.toLowerCase());if(_isPasswordField(prop)){element.val(_passwords[prop])}else if(_isCheckboxField(prop)){element.prop("checked",settings[prop])}else{element.val(settings[prop])}};fill("build","sdk");fill("build","projectPath");fill("build","outputPath");fill("build","projectName");fill("build","remoteInspector");fill("sign","signingPassword");fill("sign","csk_password");fill("sign","p12_password");fill("sign","bundle_number");fill("launch","simulator");fill("launch","device");fill("launch","devicePassword")}function url(action){var target="";switch(platform.current().id){case"webworks.bb10":target="bb10";break;case"webworks.tablet":target="tablet";break;case"webworks.handset":target="smartphone";break}return host+"/"+action+"/"+target}function enable(action){$("#options-menu-"+action).removeClass("not-ready");if(action==="launch"){$("#settings-field-simulatorstatus").parent().parent().hide();$("#settings-field-simulator").parent().parent().show()}}function disable(action){$("#options-menu-"+action).addClass("not-ready");if(action==="launch"){$("#settings-field-simulatorstatus").parent().parent().show();$("#settings-field-simulator").parent().parent().hide()}}function getSimulators(){if(!_settings.get().sdk){$("#settings-field-simulatorstatus").text("");disable("launch");return}bus.ajax("POST",host+"/simulators",_settings.get(),function(resp){var sims=resp.data.simulators;$("#settings-field-simulator").empty();if(sims.length>0){$(resp.data.simulators.map(function(sim){return"<option value='"+sim+"'>"+sim+"</option>"}).join()).appendTo("#settings-field-simulator");enable("launch")}else{disable("launch");$("#settings-field-simulatorstatus").text("No simulators found :(")}},function(){disable("launch");$("#settings-field-simulatorstatus").text("Error attempting to get simulators :(")})}function _startProgress(){if(progressInterval){window.clearInterval(progressInterval)}progressInterval=window.setInterval(function(){if(progressContainer.html().length===5){progressContainer.html(".")}else{progressContainer.html(progressContainer.html()+".")}},250)}function _endProgress(){window.clearInterval(progressInterval);progressInterval=null;progressContainer.html("")}_self={initialize:function(){$("#settings-dialog").dialog({autoOpen:false,modal:true,width:700,title:"Settings",position:"center"}).hide();$("#settings-tabs").tabs();$("#settings-action").button();create();if(platform.current().id==="webworks.handset"){enable("build");enable("sign");enable("settings");getSimulators();$("#settings-field-sdk").change(getSimulators)}else if(platform.current().id==="webworks.tablet"){enable("build");enable("sign");enable("launch");enable("settings")}else if(platform.current().id==="webworks.bb10"){enable("build");enable("sign");enable("launch");enable("settings")}},can:function(action){var settings={};utils.mixin(_settings.get(),settings);utils.mixin(_passwords,settings);return action&&missing(settings,action).length===0},value:function(prop){var settings={};utils.mixin(_settings.get(),settings);return settings[prop]},show:function(action){var settings={};utils.mixin(_settings.get(),settings);utils.mixin(_passwords,settings);populate(settings);$("#settings-dialog").dialog("open");$("#settings-action").button("option","label",action||"Close")[action?"show":"hide"]();if(action){missing(settings,action).forEach(function(field){$("#settings-field-"+field.toLowerCase()).effect("highlight",{color:"red"},1500)});$("#settings-action").unbind("click").click(function(){if(_self.can(action)){_self.perform(action);$("#settings-dialog").dialog("close")}else{_self.show(action)}})}},perform:function(action){var settings=_settings.get(),data={},poll=function(resp){var notifications=ripple("notifications");if(resp&&resp.code!==0){notifications.openNotification("error","Build request failed with message: "+resp.msg);_endProgress()}else{if(resp&&resp.data.status==="building"){setTimeout(function(){bus.ajax("GET",host+"/build_status/"+resp.data.id,null,poll,function(error){notifications.openNotification("error","Build request failed with message: "+JSON.stringify(error));_endProgress()})},500)}else{if(action.match(/sign/)){settings["bundle_number"]=$("#settings-field-bundle_number").val(parseInt($("#settings-field-bundle_number").val(),10)+1).val();_settings.save(settings)}notifications.openNotification("normal","Build succeeded!");_endProgress()}}};utils.mixin(settings,data);utils.mixin(_passwords,data);bus.ajax("POST",url(action),data,function(resp){_startProgress();poll(resp)},function(error){
var message="Build request failed with message: "+error.data;if(error.code===0||error.code===404){message+="<br>This could be due to the Build and Deploy services not running or not being installed"}notifications.openNotification("error",message)})}};module.exports=_self});ripple.define("ui/plugins/settings",function(ripple,exports,module){var db=ripple("db"),constants=ripple("constants"),utils=ripple("utils"),PROXY_SETTINGS_LIST=constants.XHR.PROXY_SETTINGS_LIST,DEFAULT_LOCAL_PORT=constants.XHR.DEFAULT_LOCAL_PORT,DEFAULT_LOCAL_ROUTE=constants.XHR.DEFAULT_LOCAL_ROUTE,LOCAL_PROXY_PORT_SETTING=constants.XHR.LOCAL_PROXY_PORT_SETTING,LOCAL_PROXY_ROUTE_SETTING=constants.XHR.LOCAL_PROXY_ROUTE_SETTING,PROXY_SETTING=constants.XHR.PROXY_SETTING;function _saveAndReload(key,value){jWorkflow.order(function(prev,baton){baton.take();db.save(key,value,null,baton.pass)}).start(function(){location.reload()})}function _initialize(){var select=document.getElementById("settings-xhr-proxy"),about=ripple("ui/plugins/about-dialog"),localProxyRouteSetting,localProxyPortSetting,route;select.value=String(db.retrieve(PROXY_SETTING));if(!Object.keys(PROXY_SETTINGS_LIST).some(function(key){return select.value===PROXY_SETTINGS_LIST[key]})){select.value=PROXY_SETTINGS_LIST.local;db.save(PROXY_SETTING,select.value)}if(select.value===PROXY_SETTINGS_LIST.local){localProxyPortSetting=jQuery("#"+LOCAL_PROXY_PORT_SETTING);localProxyPortSetting.val(db.retrieve(LOCAL_PROXY_PORT_SETTING)||DEFAULT_LOCAL_PORT).parent().parent().css("display","table-row");utils.bindAutoSaveEvent(localProxyPortSetting,function(){db.save(LOCAL_PROXY_PORT_SETTING,localProxyPortSetting.val())});localProxyRouteSetting=jQuery("#"+LOCAL_PROXY_ROUTE_SETTING);route=db.retrieve(LOCAL_PROXY_ROUTE_SETTING);localProxyRouteSetting.val(route||route===""?route:DEFAULT_LOCAL_ROUTE).parent().parent().css("display","table-row");utils.bindAutoSaveEvent(localProxyRouteSetting,function(){db.save(LOCAL_PROXY_ROUTE_SETTING,localProxyRouteSetting.val())})}if(select.value===PROXY_SETTINGS_LIST.remote){jQuery("#remote-proxy-warn").css("display","block")}select.addEventListener("change",function(){_saveAndReload(PROXY_SETTING,this.value)},false);$("#options-menu-about").click(function(){about.show()})}module.exports={panel:{domId:"settings-container",collapsed:true,pane:"right"},initialize:_initialize}});ripple.define("ui/plugins/themeSwitcher",function(ripple,exports,module){var utils=ripple("utils"),db=ripple("db"),THEME_KEY="ui-theme",THEME_SELECTOR="#theme-select",_currentTheme;function _saveAndReload(key,value){jWorkflow.order(function(prev,baton){baton.take();db.save(key,value,null,baton.pass)}).start(function(){location.reload()})}module.exports={initialize:function(){var node=jQuery(THEME_SELECTOR),themeToSet=db.retrieve(THEME_KEY),themes=ripple("ui/themes");if(themeToSet&&!utils.some(themes,function(some,index){return themes[index]===themeToSet})){_saveAndReload(THEME_KEY,themes[0])}else{utils.forEach(themes,function(theme){node.append(utils.createElement("option",{value:theme,innerHTML:theme}))});if(themes.length>1){node.val(themeToSet);node.bind("change",function(){_currentTheme=node.val();_saveAndReload(THEME_KEY,_currentTheme)})}else{jQuery(".theme-switcher").hide()}}}}});ripple.define("ui/plugins/tooltip",function(ripple,exports,module){var utils=ripple("utils"),_options={track:true,delay:0,showURL:false,fade:250,extraClass:"ui-state-highlight ui-corner-all"};module.exports={create:function(element,message){var options=utils.copy(_options);options.bodyHandler=function(){return message};return jQuery(element).tooltip(options)},toggle:function(){jQuery.tooltip.block();return this.isOff()},isOff:function(){return jQuery.tooltip.blocked}}});ripple.define("ui/plugins/tooltips",function(ripple,exports,module){var tooltip=ripple("ui/plugins/tooltip"),constants=ripple("constants"),db=ripple("db");function _updateButtonText(){document.querySelector("#settings-toggletooltips > span").innerHTML="Turn "+(tooltip.isOff()?"On":"Off")}module.exports={initialize:function(){var saved=db.retrieve(constants.SETTINGS.TOOLTIPS_KEY);if(!tooltip.isOff()&&(saved==="false"||saved===false)){tooltip.toggle()}_updateButtonText();jQuery(constants.SETTINGS.TOOLTIPS_TOGGLE_DIV).click(function(){db.save(constants.SETTINGS.TOOLTIPS_KEY,!tooltip.toggle());_updateButtonText()})}}});ripple.define("ui/plugins/videoPlayer",function(ripple,exports,module){var constants=ripple("constants"),event=ripple("event");module.exports={initialize:function(){var videoObj,videoProgress=document.getElementById(constants.COMMON.MULTIMEDIA_VIDEO_PROGRESS_ID);event.on("MultimediaAppVideoPlayerCreated",function(videoDOMObj){videoObj=videoDOMObj;videoObj.addEventListener("timeupdate",function(){var s=parseInt(videoObj.currentTime%60,10),m=parseInt(videoObj.currentTime/60%60,10);videoProgress.innerHTML=(m>9?m:"0"+m)+":"+(s>9?s:"0"+s)},false)});event.on("MultimediaVolumeChanged",function(volume){if(videoObj){videoObj.volume=parseFloat(volume/10)}});event.on("MultimediaVideoStateChanged",function(state){document.getElementById(constants.COMMON.MULTIMEDIA_VIDEO_STATE_FIELD_ID).innerHTML=state;document.getElementById(constants.COMMON.MULTIMEDIA_VIDEO_FILE_FIELD_ID).innerHTML=videoObj.getAttribute("src")})}}});ripple.define("ui/plugins/virtualKeyboard",function(ripple,exports,module){var event=ripple("event"),ui=ripple("ui"),$=window.jQuery,_isAnimating,_MAX_HEIGHT="40%",_OVERLAY_VIEWS="#overlay-views",_KEYBOARD=".virtual-keyboard-container",_KEYBOARD_OVERLAY=".virtual-keyboard-overlay",_KEYBOARD_OVERLAY_WINDOW="virtual-keyboard-window";function emit(evt,args){event.trigger(evt,args,true)}function keyboardIsClosed(){return computedHeight($(_KEYBOARD)[0])===0}function computedHeight(domElement){return parseInt(window.getComputedStyle(domElement).height,10)}function distanceFromOverlayTop(elem){return computedHeight($(_KEYBOARD_OVERLAY)[0])-computedHeight(elem)}function animate(opts){if(_isAnimating){return}_isAnimating=true;$(_KEYBOARD).animate({height:opts.height},{complete:function(){_isAnimating=false;opts.complete()},step:function(now,fx){emit("KeyboardPosition",[distanceFromOverlayTop(fx.elem)])}})}function open(){if(_isAnimating||!keyboardIsClosed()){return}ui.showOverlay(_KEYBOARD_OVERLAY_WINDOW,null,true);$(_OVERLAY_VIEWS).css({width:"inherit",height:"inherit",position:"absolute"});emit("KeyboardOpening");animate({height:_MAX_HEIGHT,complete:emit.bind(this,"KeyboardOpened")})}function close(){if(_isAnimating||keyboardIsClosed()){return}emit("KeyboardClosing");animate({height:"0",complete:function(){emit("KeyboardClosed");ui.hideOverlay(_KEYBOARD_OVERLAY_WINDOW);$(_OVERLAY_VIEWS).css({width:"auto",height:"auto",position:"inherit"})}})}function noop(){}module.exports={initialize:noop,open:open,close:close}});ripple.define("ui/plugins/widgetConfig",function(ripple,exports,module){var constants=ripple("constants"),event=ripple("event"),utils=ripple("utils"),exception=ripple("exception"),tooltip=ripple("ui/plugins/tooltip"),widgetConfig=ripple("widgetConfig");function _buildConfigAccordionNode(node,accordionContainer,counter){var nodeDiv,nodeTitleH3,nodeContentDiv,tableString,attribute,child,result,tableClass,nameClass,attributeNameClass,messageClass,nameId,messageId,attributeName,attributeValue,attributeMessage,helpText={},nodeCounter=0,attributeCounter=0,moreNodes=node.validationResult,createTooltip=function(value,index){tooltip.create("#"+index,value)};while(moreNodes){result=node.validationResult[nodeCounter];if(!result){return}nodeDiv=utils.createElement("div",{id:"config-accordion-node-content-"+counter+"-"+nodeCounter,"class":"ui-corner-all"});nodeTitleH3=utils.createElement("h3",{id:"config-accordion-node-title-"+counter+"-"+nodeCounter,"class":"config-accordion-node-title"});nodeTitleH3.appendChild(utils.createElement("a",{href:"#",innerHTML:node.nodeName,"class":constants.CONFIG.SUCCESS_CSS[result.valid===undefined?"missing":result.valid.toString()]}));nodeDiv.appendChild(nodeTitleH3);if(node.helpText){helpText[nodeTitleH3.id]=node.helpText}nodeContentDiv=utils.createElement("div");if(node.type||!node.type&&result&&result.value){nodeContentDiv.appendChild(utils.createElement("div",{id:"config-accordion-node-content-value-"+counter+"-"+nodeCounter,"class":"config-accordion-node-content-value",innerHTML:"<span>Value:</span>"+(result.value||"")}));if(node.helpValueText){helpText["config-accordion-node-content-value-"+counter+"-"+nodeCounter]=node.helpValueText}}if(result&&result.message){nodeContentDiv.appendChild(utils.createElement("div",{id:"config-accordion-node-content-value-message-"+counter+"-"+nodeCounter,"class":"config-accordion-node-content-value-message ui-text-fail",innerHTML:"<span>Message:</span>"+result.message}))}if(result.attributes){nodeContentDiv.appendChild(utils.createElement("div",{id:"config-accordion-node-content-attributes-title-"+counter+"-"+nodeCounter,"class":"config-accordion-node-content-attributes-title",innerHTML:"Attributes..."}));tableClass="preferences-table";nameClass="config-attributes-name-value";attributeNameClass="ui-text-label";messageClass="config-attributes-message";tableString='<table class="'+tableClass+' ui-widget-content">';for(attribute in result.attributes){if(result.attributes.hasOwnProperty(attribute)){nameId="config-accordion-node-content-attributes-table-name-"+counter+"-"+nodeCounter+"-"+attributeCounter;messageId="config-accordion-node-content-attributes-table-message-"+counter+"-"+nodeCounter+"-"+attributeCounter;attributeName=result.attributes[attribute].attributeName;attributeValue=result.attributes[attribute].value||" ";attributeMessage=result.attributes[attribute].message||null;tableString+='<tr class="'+nameClass+'" id="'+nameId+'">'+'<td class="'+attributeNameClass+'">'+attributeName+"</td>"+"<td>"+attributeValue+"</td></tr>";if(node.attributes[attributeName].helpText){helpText[nameId]=node.attributes[attributeName].helpText}if(attributeMessage!==null){tableString+="<tr class="+messageClass+" id="+messageId+'><td colspan="2">'+attributeMessage+"</td></tr>"}attributeCounter++}}tableString+="</table>";nodeContentDiv.innerHTML+=tableString}nodeDiv.appendChild(nodeContentDiv);accordionContainer.appendChild(nodeDiv);utils.forEach(helpText,createTooltip);nodeCounter++;if(!node.validationResult[nodeCounter]){nodeCounter=0;moreNodes=false}}if(node.children){for(child in node.children){if(node.children.hasOwnProperty(child)){counter++;_buildConfigAccordionNode(node.children[child],accordionContainer,counter)}}}}function _initializeConfigResultsView(results){try{var rootNode,accordionContainer=document.getElementById("widget-config");accordionContainer.innerHTML="";if(!results){accordionContainer.appendChild(utils.createElement("div",{"class":"config-accordion-node-title "+constants.CONFIG.SUCCESS_CSS["false"],innerHTML:"config.xml file could not be found in the application's root or is malformed XML"}));return}rootNode=results[results.rootElement];_buildConfigAccordionNode(rootNode,accordionContainer,0);jQuery(function(){var stop=false;jQuery("#widget-config h3").click(function(event){if(stop){event.stopImmediatePropagation();event.preventDefault();stop=false}});jQuery("#widget-config").accordion("destroy").accordion({header:"> div > h3",autoHeight:false})})}catch(e){exception.handle(e,true)}}event.on("FrameHistoryChange",function(){module.exports.initialize()});module.exports={panel:{domId:"config-container",collapsed:true,pane:"right"},initialize:function(){var results=widgetConfig.getValidationResults();_initializeConfigResultsView(results)}}});ripple.define("ui/themes",function(ripple,exports,module){module.exports=["dark","light"]});ripple.define("ui",function(ripple,exports,module){var _self,db=ripple("db"),platform=ripple("platform"),constants=ripple("constants"),utils=ripple("utils"),exception=ripple("exception"),event=ripple("event"),themes=ripple("ui/themes"),_applicationStateId,_applicationState,_availablePanels,_systemPlugins=["about-dialog","settings-dialog","exec-dialog","firstRunCheck","devices","goodVibrations","panelCollapse","platform","information","layout","notifications","tooltip","tooltips","camera","themeSwitcher","settings","browser"],_overlay={getOrCreate:function(id){var _container=document.getElementById(constants.COMMON.HTML_CONTAINER),_overlays=document.getElementById("overlay-views"),_overlay=_overlays.children[id],_hide=function(node){node.setAttribute("style","display: none")},_show=function(node){node.setAttribute("style","display: block")},_trigger=function(callback){if(callback){callback.apply(null,[_overlay])}};if(!_overlay){_overlay=utils.createElement("section",{id:id,"class":"overlay"});_overlays.appendChild(_overlay)}return{hide:function(callback){_hide(_overlay);_show(_container);_trigger(callback)},show:function(callback,showContainer){_show(_overlay);if(!showContainer){_hide(_container)}_trigger(callback)}}}};function _addUIPaneItemsToApplicationState(arrayObj,pane){utils.forEach(arrayObj,function(domId){var collapsed=jQuery("#"+domId+" .info")[0];collapsed=collapsed.style&&collapsed.style.display==="none"?true:false;_applicationState.push({domId:domId,collapsed:collapsed,pane:pane})})}function _currentlyEnabledTheme(){var qsSet=utils.queryString().theme,current=db.retrieve("ui-theme")||themes[0];function matches(something){return function(item){return something===item}}if(qsSet&&themes.some(matches(qsSet))){current=qsSet;db.save("ui-theme",qsSet)}return current}function _insertStyleSheets(){var uiTheme=_currentlyEnabledTheme(),extensionURL=jQuery("#extension-url").text(),uiThemeURL=extensionURL+"themes/"+uiTheme+"/theme.css",head=document.getElementsByTagName("head")[0];function stylesheet(src){var scriptElement=document.createElement("link");scriptElement.setAttribute("href",src);scriptElement.setAttribute("type","text/css");scriptElement.setAttribute("rel","stylesheet");return scriptElement}head.appendChild(stylesheet(uiThemeURL))}function _initializeUI(){_applicationStateId=constants.COMMON.APPLICATION_STATE+(db.retrieveObject("api-key")||constants.PLATFORM.DEFAULT).name;_applicationState=db.retrieveObject(_applicationStateId)||[];_insertStyleSheets();var leftPanelSection=jQuery(".left"),rightPanelSection=jQuery(".right"),uiBoxToggleEngaged=false;db.remove("ui-application-state");utils.forEach(_availablePanels,function(obj){var matchingDomId=function(panel){return panel.domId===obj.domId};if(!utils.some(_applicationState,matchingDomId)){_applicationState.push({domId:obj.domId,collapsed:obj.collapsed,pane:obj.pane})}});utils.forEach(_applicationState,function(obj){var node=jQuery("#"+obj.domId),matchingDomId=function(panel){return panel.domId===obj.domId};if(node.length>0){if(!utils.some(_availablePanels,matchingDomId)){node.parent()[0].removeChild(node[0])}else{if(obj.pane==="left"){leftPanelSection.append(node.parent()[0].removeChild(node[0]))}if(obj.pane==="right"){rightPanelSection.append(node.parent()[0].removeChild(node[0]))}if(!obj.collapsed){node.find(".info").css({display:"block"}).end().addClass("ui-box-open")}}}});db.saveObject(_applicationStateId,_applicationState);event.on("ApplicationState",function(){try{var leftArray=jQuery(".left").sortable("toArray"),rightArray=jQuery(".right").sortable("toArray");_applicationState=[];_addUIPaneItemsToApplicationState(leftArray,"left");_addUIPaneItemsToApplicationState(rightArray,"right");db.saveObject(_applicationStateId,_applicationState)}catch(e){exception.handle(e)}});jQuery(".right, .left").sortable({handle:".drag-handle",revert:true,placeholder:"ui-sortable-highlight ui-corner-all",connectWith:[".right, .left"],scroll:false,update:function(){event.trigger("ApplicationState")}});jQuery(".collapse-handle").bind("click",function(){if(!uiBoxToggleEngaged){uiBoxToggleEngaged=true;var jNode=jQuery(this).parentsUntil(".ui-box"),pNode=jNode.parent(),isOpen=pNode.hasClass("ui-box-open");if(!isOpen){pNode.addClass("ui-box-open")}jQuery(this).parent().next().toggle("blind",{},300,function(){if(isOpen){pNode.removeClass("ui-box-open")}event.trigger("ApplicationState",[pNode]);uiBoxToggleEngaged=false})}})}_self=module.exports={initialize:function(){var plugins=_systemPlugins.concat(platform.current().ui.plugins||[]).map(function(name){return ripple("ui/plugins/"+name)}),boot=jWorkflow.order(_initializeUI);_availablePanels=[];plugins.forEach(function(plugin){if(plugin.initialize){boot.andThen(plugin.initialize)}if(plugin.panel){_availablePanels.push(plugin.panel)}});boot.start()},getSystemPlugins:function(){return utils.copy(_systemPlugins)},register:function(plugin){_systemPlugins.push(plugin)},registered:function(plugin){return _systemPlugins.indexOf(plugin)>=0},getExtensionURL:function(){return jQuery("#"+constants.COMMON.EXTENSION_URL_CONTAINER).text()},showOverlay:function(id,callback,showContainer){_overlay.getOrCreate(id).show(callback,showContainer)},hideOverlay:function(id,callback){_overlay.getOrCreate(id).hide(callback)}}});ripple.define("utils",function(ripple,exports,module){var self,exception=ripple("exception"),_HtmlElements=["header","footer","section","aside","nav","article"];self=module.exports={validateNumberOfArguments:function(lowerBound,upperBound,numberOfArguments,customExceptionType,customExceptionMessage,customExceptionObject){customExceptionMessage=customExceptionMessage||"";if(arguments.length<3||arguments.length>6){exception.raise(exception.types.Argument,"Wrong number of arguments when calling: validateNumberOfArguments()")}if(isNaN(lowerBound)&&isNaN(upperBound)&&isNaN(numberOfArguments)){exception.raise(exception.types.ArgumentType,"(validateNumberOfArguments) Arguments are not numbers")}lowerBound=parseInt(lowerBound,10);upperBound=parseInt(upperBound,10);numberOfArguments=parseInt(numberOfArguments,10);if(numberOfArguments<lowerBound||numberOfArguments>upperBound){exception.raise(customExceptionType||exception.types.ArgumentLength,customExceptionMessage+"\n\nWrong number of arguments",customExceptionObject)}},validateArgumentType:function(arg,argType,customExceptionType,customExceptionMessage,customExceptionObject){var invalidArg=false,msg;switch(argType){case"array":if(!(arg instanceof Array)){invalidArg=true}break;case"date":if(!(arg instanceof Date)){invalidArg=true}break;case"integer":if(typeof arg==="number"){if(arg!==Math.floor(arg)){invalidArg=true}}else{invalidArg=true}break;default:if(typeof arg!==argType){invalidArg=true}break}if(invalidArg){msg=customExceptionMessage+("\n\nInvalid Argument type. argument: "+arg+" ==> was expected to be of type: "+argType);exception.raise(customExceptionType||exception.types.ArgumentType,msg,customExceptionObject)}},validateMultipleArgumentTypes:function(argArray,argTypeArray,customExceptionType,customExceptionMessage,customExceptionObject){for(var i=0;i<argArray.length;i++){this.validateArgumentType(argArray[i],argTypeArray[i],customExceptionType,customExceptionMessage,customExceptionObject)}},createElement:function(elementType,attributes){var d=document.createElement(elementType);if(attributes){this.forEach(attributes,function(attributeValue,attributeName){switch(attributeName.toLowerCase()){case"innerhtml":d.innerHTML=attributeValue;break;case"innertext":d.innerText=attributeValue;break;default:d.setAttribute(attributeName,attributeValue)}})}return d},loadHTMLElements:function(){for(var i=0;i<_HtmlElements.length;i+=1){document.createElement(_HtmlElements[i])}},getAllStylesheetRules:function getAllStylesheetRules(title){this.validateNumberOfArguments(1,1,arguments.length);var i,x,sheet,rules,styles_array=[];for(i=0;i<document.styleSheets.length;i+=1){sheet=document.styleSheets[i];rules=sheet.cssRules;if(rules){for(x=0;x<rules.length;x+=1){if(rules[x].selectorText&&rules[x].selectorText===title.toString()){styles_array.push(rules[x])}}}}return styles_array},location:function(){return window.location},queryString:function(){var args=this.location().search.replace(/^\?/,"").split("&");return args.reduce(function(obj,value){if(value){value=value.toLowerCase().split("=");obj[value[0]]=value[1]}return obj},{})},extensionUrl:function(){return document.getElementById("extension-url").innerHTML},appLocation:function(){var loc=self.location(),parts=loc.pathname.split("/"),base="",port=loc.port?":"+loc.port:"";if(parts[parts.length-1].match(/\.\w*$/)){parts=parts.splice(0,parts.length-1)}base=parts.join("/").replace(/\/$/,"");return loc.protocol+"//"+loc.hostname+port+base+"/"},arrayContains:function(array,obj){var i=array.length;while(i--){if(array[i]===obj){return true}}return false},some:function(obj,predicate,scope){if(obj instanceof Array){return obj.some(predicate,scope)}else{var values=self.map(obj,predicate,scope);return self.reduce(values,function(some,value){return value?value:some},false)}},count:function(obj){return self.sum(obj,function(){return 1})},sum:function(obj,selector,scope){var values=self.map(obj,selector,scope);return self.reduce(values,function(total,value){return total+value})},max:function(obj,selector,scope){var values=self.map(obj,selector,scope);return self.reduce(values,function(max,value){return max<value?value:max},Number.MIN_VALUE)},min:function(obj,selector,scope){var values=self.map(obj,selector,scope);return self.reduce(values,function(min,value){return min>value?value:min},Number.MAX_VALUE)},forEach:function(obj,action,scope){if(obj instanceof Array){return obj.forEach(action,scope)}else{self.map(obj,action,scope)}},filter:function(obj,predicate,scope){if(obj instanceof Array){return obj.filter(predicate,scope)}else{var result=[];self.forEach(obj,function(value,index){if(predicate.apply(scope,[value,index])){result.push(value)}},scope);return result}},reduce:function(obj,func,init,scope){var i,initial=init===undefined?0:init,result=initial;if(window.MozNamedAttrMap)NamedNodeMap=window.MozNamedAttrMap;if(obj instanceof Array){return obj.reduce(func,initial)}else if(obj instanceof NamedNodeMap){for(i=0;i<obj.length;i++){result=func.apply(scope,[result,obj[i],i])}}else{for(i in obj){if(obj.hasOwnProperty(i)){result=func.apply(scope,[result,obj[i],i])}}}return result},map:function(obj,func,scope){var i,returnVal=null,result=[];if(window.MozNamedAttrMap)NamedNodeMap=window.MozNamedAttrMap;if(obj instanceof Array){return obj.map(func,scope)}else if(obj instanceof NamedNodeMap){for(i=0;i<obj.length;i++){returnVal=func.apply(scope,[obj[i],i]);result.push(returnVal)}}else{for(i in obj){if(obj.hasOwnProperty(i)){returnVal=func.apply(scope,[obj[i],i]);result.push(returnVal)}}}return result},regexSanitize:function(regexString){return regexString.replace("^","\\^").replace("$","\\$").replace("(","\\(").replace(")","\\)").replace("<","\\<").replace("[","\\[").replace("{","\\{").replace(/\\/,"\\\\").replace("|","\\|").replace(">","\\>").replace(".","\\.").replace("*","\\*").replace("+","\\+").replace("?","\\?")},bindAutoSaveEvent:function(node,saveCallback){var oldSetTimeoutId,jNode=jQuery(node);jNode.bind("keyup",function(event){if(event.keyCode!==9){clearTimeout(oldSetTimeoutId);oldSetTimeoutId=window.setTimeout(function(){saveCallback()},500)}})},find:function(comparison,collection,startInx,endInx,callback){var results=[],compare=function(s,pattern){if(typeof s!=="string"||pattern===null){return s===pattern}var regex=pattern.replace(/\./g,"\\.").replace(/\^/g,"\\^").replace(/\*/g,".*").replace(/\\\.\*/g,"\\*");regex="^".concat(regex,"$");return!!s.match(new RegExp(regex,"i"))};self.forEach(collection,function(c){var match,fail=false;self.forEach(comparison,function(value,key){if(!fail&&value!==undefined){if(compare(c[key],value)){match=c}else{fail=true;match=null}}});if(match){results.push(match)}});if(callback){if(startInx===undefined){startInx=0}if(endInx===undefined){endInx=results.length}if(startInx===endInx){endInx=startInx+1}callback.apply(null,[results.slice(startInx,endInx)])}},mixin:function(mixin,to){for(var prop in mixin){if(Object.hasOwnProperty.call(mixin,prop)){to[prop]=mixin[prop]}}return to},copy:function(obj){var i,newObj=jQuery.isArray(obj)?[]:{};if(typeof obj==="number"||typeof obj==="string"||typeof obj==="boolean"||obj===null||obj===undefined){return obj}if(obj instanceof Date){return new Date(obj)}if(obj instanceof RegExp){return new RegExp(obj)}for(i in obj){if(obj.hasOwnProperty(i)){if(obj[i]&&typeof obj[i]==="object"){if(obj[i]instanceof Date){newObj[i]=obj[i]}else{newObj[i]=self.copy(obj[i])}}else{newObj[i]=obj[i]}}}return newObj},navHelper:function(){return{getHeading:function(lat1,lon1,lat2,lon2){var dLon=this.rad(lon2-lon1),llat1=this.rad(lat1),llat2=this.rad(lat2),y=Math.sin(dLon)*Math.cos(llat2),x=Math.cos(llat1)*Math.sin(llat2)-Math.sin(llat1)*Math.cos(llat2)*Math.cos(dLon);return(this.deg(Math.atan2(y,x))+360)%360},getDistance:function(lat1,lon1,lat2,lon2){var dLat=this.rad(lat2-lat1),dLon=this.rad(lon2-lon1),a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(this.rad(lat1))*Math.cos(this.rad(lat2))*Math.sin(dLon/2)*Math.sin(dLon/2),c=2*Math.asin(Math.sqrt(a)),d=6378100*c;return d},simulateTravel:function(lat,lon,hdg,dist){var lat1=this.rad(lat),lon1=this.rad(lon),brng=this.rad(hdg),angularDistance=dist/6378100,lat2=Math.asin(Math.sin(lat1)*Math.cos(angularDistance)+Math.cos(lat1)*Math.sin(angularDistance)*Math.cos(brng)),lon2=lon1+Math.atan2(Math.sin(brng)*Math.sin(angularDistance)*Math.cos(lat1),Math.cos(angularDistance)-Math.sin(lat1)*Math.sin(lat2));lon2=(lon2+3*Math.PI)%(2*Math.PI)-Math.PI;return{latitude:this.deg(lat2),longitude:this.deg(lon2)}},deg:function(num){return num*180/Math.PI},rad:function(num){return num*Math.PI/180}}},defineReadOnlyField:function(obj,field,value){Object.defineProperty(obj,field,{value:value,writable:false})},parseUrl:function(url){var a=document.createElement("a");a.href=url;return{href:a.href,host:a.host,origin:a.origin,port:a.port,protocol:a.protocol,search:a.search}}}});ripple.define("widgetConfig",function(ripple,exports,module){var exception=ripple("exception"),event=ripple("event"),app=ripple("app"),_console=ripple("console"),utils=ripple("utils"),platform=ripple("platform"),_validationResult={valid:false,message:"",value:null},_configValidationResults=null;function _failNodeValidation(schemaNode,message,value,node){var validationResult=utils.copy(_validationResult);if(!schemaNode.validationResult){schemaNode.validationResult=[]}validationResult.valid=false;if(value){validationResult.value=value}else{delete validationResult.value}validationResult.message=schemaNode.nodeName+message;validationResult.node=node;schemaNode.validationResult.push(validationResult)}function _createEmptyNodeValidation(node){var validationResult=utils.copy(_validationResult),attributeValidationResult,attribute;if(!node.validationResult){node.validationResult=[]}validationResult.value="";delete validationResult.valid;delete validationResult.message;if(node.attributes){for(attribute in node.attributes){if(node.attributes.hasOwnProperty(attribute)){if(!validationResult.attributes){validationResult.attributes={}}attributeValidationResult=utils.copy(_validationResult);attributeValidationResult.attributeName=node.attributes[attribute].attributeName;delete attributeValidationResult.value;delete attributeValidationResult.valid;delete attributeValidationResult.message;validationResult.attributes[attributeValidationResult.attributeName]=attributeValidationResult}}}node.validationResult.push(validationResult)}function _validateValue(valueToTest,schemaNode){var failMessage="",nodeValue,numbers,numberRangeIndex,numberRange,range1,range2;switch(schemaNode.type){case"string":if(typeof valueToTest!=="string"){failMessage=" value was expected to be of type string but was typeof: "+typeof valueToTest}break;case"number":nodeValue=parseFloat(valueToTest);if(isNaN(nodeValue)){failMessage=" value was expected to be of type number but was typeof: "+typeof valueToTest}break;case"integer":nodeValue=parseInt(valueToTest,10);if(isNaN(nodeValue)){failMessage=" value was expected to be of type number but was typeof: "+typeof valueToTest}break;case"boolean":if(valueToTest!=="false"&&valueToTest!=="true"){failMessage=" value was expected to be of type boolean (i.e. 'true' or 'false' but was: "+valueToTest}break;case"list":if(!utils.arrayContains(schemaNode.listValues,valueToTest)){failMessage=' value is not recognized as being valid, it was:<br/><br/><span class="ui-text-fail">'+valueToTest+'</span><br/><br/>Valid values are:<p class="ui-text-pass">'+schemaNode.listValues.join(" <br/> ")+"</p>"}break;case"listBoolean":case"listDefault":if(!utils.arrayContains(schemaNode.listValues,valueToTest)){failMessage=' value is not recognized as being valid, it was:<br/><br/><span class="ui-text-fail">'+valueToTest+'</span><br/><br/>The framework will assume the value to be:<p class="ui-text-pass">'+schemaNode.defaultValue+"</p>"}break;case"listNumbers":numbers=valueToTest.split(",");for(numberRangeIndex=0;numberRangeIndex<numbers.length;numberRangeIndex++){numberRange=valueToTest.split("-");if(numberRange.length>1){range1=parseInt(numberRange[0],10);range2=parseInt(numberRange[1],10);if(isNaN(range1)||isNaN(range2)){failMessage=" range values where not recognized as being valid, they was: "+range1+" and "+range2+" :: valid values should be of type 'integer'";break}}else if(numberRange.length===1){range1=parseInt(numberRange[0],10);if(isNaN(range1)){failMessage=" value was not recognized as being valid, it was: "+range1+" :: valid values should be of type 'integer'";break}}}break;case"regex":if(!valueToTest.match(schemaNode.regex)){failMessage=" value does not match expected format. Value should pass this regular expression validation: "+schemaNode.regex}break;case"iso-language":break;default:exception.raise(exception.types.Application,"Schema node with value type of: "+schemaNode.type+" is not known")}return failMessage}function _passNodeValidation(schemaNode,value,node){var validationResult=utils.copy(_validationResult);if(!schemaNode.validationResult){schemaNode.validationResult=[]}validationResult.valid=true;validationResult.node=node;if(value){validationResult.value=value}else{delete validationResult.value}delete validationResult.message;schemaNode.validationResult.push(validationResult)}function _validateNodeValue(schemaNode,node){var failMessage,valueToTest=node&&node.nodeValue?node.nodeValue.replace(/^\s\s*/,"").replace(/\s\s*$/,""):null;if(schemaNode.type&&valueToTest){failMessage=_validateValue(valueToTest,schemaNode);if(failMessage!==""){_failNodeValidation(schemaNode,failMessage,valueToTest,node);return}}_passNodeValidation(schemaNode,valueToTest,node)}function _failNodeAttributeValidation(node,attribute,message,value){var nodeValidationResult=node.validationResult?node.validationResult.pop():utils.copy(_validationResult),attributeValidationResult=utils.copy(_validationResult);if(!nodeValidationResult.attributes){nodeValidationResult.attributes={}}nodeValidationResult.valid=false;nodeValidationResult.message="One or more attributes failed validation";attributeValidationResult.attributeName=attribute.attributeName;attributeValidationResult.valid=false;if(value){attributeValidationResult.value=value}else{delete attributeValidationResult.value}attributeValidationResult.message=node.nodeName+"."+attribute.attributeName+message;nodeValidationResult.attributes[attribute.attributeName]=attributeValidationResult;node.validationResult.push(nodeValidationResult)}function _passNodeAttributeValidation(node,attribute,value){var nodeValidationResult=node.validationResult?node.validationResult.pop():utils.copy(_validationResult),attributeValidationResult=utils.copy(_validationResult);if(!nodeValidationResult.attributes){nodeValidationResult.attributes={}}attributeValidationResult.attributeName=attribute.attributeName;attributeValidationResult.valid=true;if(value){attributeValidationResult.value=value}else{delete attributeValidationResult.value}delete attributeValidationResult.message;nodeValidationResult.attributes[attribute.attributeName]=attributeValidationResult;node.validationResult.push(nodeValidationResult);
}function _validateNodeAttributeValue(schemaNode,schemaNodeAttribute,attribute){var failMessage,valueToTest=attribute?attribute.value.replace(/^\s\s*/,"").replace(/\s\s*$/,""):null;if(schemaNodeAttribute.type&&valueToTest){failMessage=_validateValue(valueToTest,schemaNodeAttribute);if(failMessage!==""){_failNodeAttributeValidation(schemaNode,schemaNodeAttribute,failMessage,valueToTest);return}}_passNodeAttributeValidation(schemaNode,schemaNodeAttribute,valueToTest)}function _validateNodeAttributes(schemaNode,node,children){var siblings=utils.filter(children,function(child){return child!==node}),attributeConverter=function(attribute){var _self={toValue:function(n){var obj=_self.toNode(n);return obj?obj.value:null},toNode:function(n){return n.attributes.getNamedItem(attribute.attributeName)}};return _self};utils.forEach(schemaNode.attributes,function(attribute){var convert=attributeConverter(attribute),dupe=false;if(attribute.unique){dupe=siblings.some(function(sibling){return convert.toValue(sibling)===convert.toValue(node)});if(dupe){_failNodeAttributeValidation(schemaNode,attribute," node is allowed to appear multiple times, however it must be unique based on this attribute and in this case another node with an identical attribute vale was found",convert.toValue(node));return}}if(attribute.required&&!convert.toValue(node)){_failNodeAttributeValidation(schemaNode,attribute," attribute was expected but not found",null)}else{_validateNodeAttributeValue(schemaNode,attribute,convert.toNode(node))}})}function _validateNode(schemaNode,parentNode){var children=utils.filter(parentNode.childNodes,function(child){return child&&child.nodeName===schemaNode.nodeName});if(children.length===0){if(schemaNode.required){_failNodeValidation(schemaNode," node expected, but not found",null,null)}else{_createEmptyNodeValidation(schemaNode)}}utils.forEach(children,function(child){if(schemaNode.occurrence!==0&&schemaNode.occurrence<children.length){_failNodeValidation(schemaNode," node: more then "+schemaNode.occurrence+" node(s) found",null,child)}else{_validateNodeValue(schemaNode,child.childNodes[0]||child);_validateNodeAttributes(schemaNode,child,children)}utils.forEach(schemaNode.children,function(schema){_validateNode(schema,child)})})}function _validateAgainstSchemaNode(configSchema,configXML){var results=utils.copy(configSchema);try{_validateNode(results[configSchema.rootElement],configXML)}catch(e){exception.handle(e,true)}return results}function _validate(configXML){return _validateAgainstSchemaNode(platform.current().config.schema,configXML)}function _process(results){var validVersion=app.validateVersion(results);if(!validVersion){_console.warn("Your application does not appear to match"+" the platform you have selected. The version number in your configuration might not "+"match the selected platform version or your configuration file has errors in it.")}app.saveInfo(results);event.trigger("WidgetInformationUpdated");if(app.getInfo().preferences!=={}){event.trigger("StorageUpdatedEvent")}}function _xmlToJson(xml){var obj={};if(xml.nodeType===1){if(xml.attributes.length>0){obj["@attributes"]={};utils.forEach(xml.attributes,function(attribute){obj["@attributes"][attribute.nodeName]=attribute.nodeValue})}}else if(xml.nodeType===3){obj=xml.nodeValue}if(xml.hasChildNodes&&xml.hasChildNodes()){utils.forEach(xml.childNodes,function(child){if(!child.nodeName){return}if(!obj[child.nodeName]){obj[child.nodeName]=[]}obj[child.nodeName].push(_xmlToJson(child))})}return obj}module.exports={validate:function(configXML){utils.validateNumberOfArguments(1,1,arguments.length);return _validate(configXML)},initialize:function(){var xmlHttp=new XMLHttpRequest,config=platform.current().config,fileName=config?config.fileName:null,results;if(!fileName){return}try{xmlHttp.open("GET",utils.appLocation()+fileName,false);xmlHttp.send();if(xmlHttp.responseXML){results=_validate(xmlHttp.responseXML);results.rawJSON=_xmlToJson(xmlHttp.responseXML);_process(results);_configValidationResults=results}else{_process();_configValidationResults=null;ripple("ui/plugins/widgetConfig").initialize()}}catch(e){exception.handle(e)}},getValidationResults:function(){return _configValidationResults}}});ripple.define("xhr/base",function(ripple,exports,module){var XHR=window.XMLHttpRequest;function _handle(object,key){return function(){return object[key].apply(object,Array.prototype.slice.call(arguments))}}function _getter(object,key){return function(){return object[key]}}function _setter(object,key){return function(val){object[key]=val}}function _writeable(obj){var newObj={},key;for(key in obj){if(key!=="responseBlob"&&typeof obj[key]==="function"){newObj[key]=_handle(obj,key)}else{newObj.__defineGetter__(key,_getter(obj,key));newObj.__defineSetter__(key,_setter(obj,key))}}return newObj}function _XMLHttpRequest(){var Xhr=ripple("emulatorBridge").xhr()||XHR;return _writeable(new Xhr)}module.exports=_XMLHttpRequest});ripple.define("xhr/cors",function(ripple,exports,module){var helpers=ripple("xhr/helpers"),constants=ripple("constants"),XHR=ripple("xhr/base");function _XMLHttpRequest(){var xhr=new XHR,origMethods={setRequestHeader:xhr.setRequestHeader,open:xhr.open};xhr.setRequestHeader=function(header){if(header&&header.toUpperCase()!=="X-REQUESTED-WITH"){origMethods.setRequestHeader.apply(xhr,Array.prototype.slice.call(arguments))}};xhr.open=function(method,url){var isSameOriginRequest=helpers.isSameOriginRequest(url);if(!isSameOriginRequest){url=(helpers.proxyIsRemote()?constants.API_URL:helpers.localProxyRoute())+"/xhr_proxy?tinyhippos_apikey=ABC&tinyhippos_rurl="+escape(url)}origMethods.open.apply(xhr,Array.prototype.slice.call(arguments));if(!isSameOriginRequest){xhr.setRequestHeader("X-Ripple-User-Agent",navigator.userAgent)}};return xhr}module.exports=_XMLHttpRequest});ripple.define("xhr/helpers",function(ripple,exports,module){var constants=ripple("constants"),db=ripple("db"),utils=ripple("utils"),PROXY_SETTINGS_LIST=constants.XHR.PROXY_SETTINGS_LIST,_self;_self={isSameOriginRequest:function(url){var sameOrigin;url=utils.parseUrl(url);if(url.port!==location.port){return false}sameOrigin=url.href.match(location.origin.replace(/www\./,""))||!url.href.match(constants.REGEX.NON_RELATIVE_URI);return!!sameOrigin},proxyEnabled:function(){return db.retrieve(constants.XHR.PROXY_SETTING)!==PROXY_SETTINGS_LIST.disabled},proxyIsRemote:function(){var proxySetting=db.retrieve(constants.XHR.PROXY_SETTING);return _self.proxyEnabled()&&(proxySetting?proxySetting===PROXY_SETTINGS_LIST.remote:true)},localProxyRoute:function(){var route;route=db.retrieve(constants.XHR.LOCAL_PROXY_ROUTE_SETTING);return"http://localhost:"+(db.retrieve(constants.XHR.LOCAL_PROXY_PORT_SETTING)||constants.XHR.DEFAULT_LOCAL_PORT)+(route||route===""?route:constants.XHR.DEFAULT_LOCAL_ROUTE)}};module.exports=_self});ripple.define("xhr/jsonp",function(ripple,exports,module){var constants=ripple("constants"),exception=ripple("exception"),utils=ripple("utils"),helpers=ripple("xhr/helpers"),_console=ripple("console"),XHR=ripple("xhr/base");function _XMLHttpRequest(){var xhr=new XHR,origMethods={setRequestHeader:xhr.setRequestHeader,getResponseHeader:xhr.getResponseHeader,getAllResponseHeaders:xhr.getAllResponseHeaders,open:xhr.open,send:xhr.send,abort:xhr.abort},_jxhr=new window.jXHR,_sendFlag=false,_headers=[],_errorFlag=false,_url,_async;function _sameOriginRequest(){return _url&&helpers.isSameOriginRequest(_url)}function _set(prop,value){xhr.__defineGetter__(prop,function(){return value})}function _reset(){_set("response","");_set("responseText","");_set("responseXML",null)}xhr.setRequestHeader=function(){if(_sameOriginRequest()){origMethods.setRequestHeader.apply(xhr,Array.prototype.slice.call(arguments))}else{_console.error("XMLHttpRequest :: setRequestHeader does not work with JSONP.")}};xhr.getResponseHeader=function(header){return _sameOriginRequest()?origMethods.getAllResponseHeaders.apply(xhr,[header]):_headers[header]||null};xhr.getAllResponseHeaders=function(){return _sameOriginRequest()?origMethods.getAllResponseHeaders.apply(xhr):utils.reduce(_headers,function(str,value,key){return str+key+": "+value+"\n"},"").replace(/\n$/,"")};xhr.open=function(method,url,async){_url=url;_async=async!==false?true:false;if(_sameOriginRequest()){origMethods.open.apply(xhr,Array.prototype.slice.call(arguments))}else{_reset();method=method.toUpperCase();if(method==="POST"){method="GET"}if(method!=="GET"){exception.raise(exception.types.MethodNotImplemented,"Method: "+method+" not supported!")}_jxhr.onreadystatechange=function(data){var response;try{_set("readyState",_jxhr.readyState);if(xhr.readyState===xhr.DONE){_sendFlag=false;_set("status",data.status);_set("statusText",data.statusText);_headers=data.headers;if(data.responseXML){response=(new DOMParser).parseFromString(unescape(data.responseXML),"text/xml");_set("responseXML",response)}else{response=unescape(data.responseText);_set("responseText",response)}_set("response",response)}if(typeof xhr.onreadystatechange==="function"){xhr.onreadystatechange.apply(xhr)}}catch(e){exception.handle(e)}};_jxhr.onerror=xhr.onerror;_jxhr.open(method,(helpers.proxyIsRemote()?constants.API_URL:helpers.localProxyRoute())+"/jsonp_xhr_proxy?callback=?&tinyhippos_apikey=ABC&tinyhippos_rurl="+escape(url)+"&ripple_user_agent="+escape(navigator.userAgent))}};xhr.send=function(data){if(_sameOriginRequest()){origMethods.send(data);return}if(!_async){exception.raise(exception.types.MethodNotImplemented,"Synchronous not supported.")}if(xhr.readyState!==xhr.OPENED||_sendFlag===true){exception.raise(exception.types.InvalidState,"Ready state should be OPENED (1)")}_errorFlag=false;_sendFlag=true;data=null;_jxhr.send()};xhr.abort=function(){if(_sameOriginRequest()){origMethods.abort();return}_reset();_errorFlag=true;if(xhr.readyState===xhr.UNSENT||xhr.readyState===xhr.OPENED&&_sendFlag===false||xhr.readyState===xhr.DONE){_set("readyState",xhr.UNSENT)}else{_set("readyState",xhr.DONE);_sendFlag=false;if(typeof xhr.onreadystatechange==="function"){xhr.onreadystatechange.apply(xhr)}}_jxhr.onreadystatechange=null;if(xhr.onabort){xhr.onabort.apply(xhr,arguments)}};return xhr}module.exports=_XMLHttpRequest});ripple.define("xhr",function(ripple,exports,module){var utils=ripple("utils"),helpers=ripple("xhr/helpers");module.exports={initialize:function(){window.XMLHttpRequest=ripple("xhr/base");if(helpers.proxyEnabled()){var isFileScheme=utils.location().protocol.match(/^file:/);window.XMLHttpRequest=ripple(isFileScheme?"xhr/jsonp":"xhr/cors")}}}})})();ripple("bootstrap").bootstrap();
|